Skip to content

Commit

Permalink
Merge pull request #145 from Portkey-AI/feat/logsPOST
Browse files Browse the repository at this point in the history
Insert Log
  • Loading branch information
csgulati09 authored Dec 11, 2024
2 parents e944bc6 + b2da109 commit aa3b54b
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
29 changes: 28 additions & 1 deletion src/apis/logsExport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import { ApiResource } from '../apiResource';
import { APIResponseType, ApiClientInterface } from '../_types/generalTypes';
import { APIPromise, RequestOptions } from '../baseClient';
import { createHeaders } from './createHeaders';
import { toQueryParams } from '../utils';
import { overrideConfig, toQueryParams } from '../utils';
import { LOGS_API } from '../constants';

export interface LogsExportCreateParams {
filters?: Record<string, any>;
Expand Down Expand Up @@ -71,12 +72,38 @@ export interface LogsExportDownloadParams {
export interface LogsExportDownloadResponse extends APIResponseType {
signed_url?: string;
}

export interface LogInsertBody {
request?: Record<string, any>;
response?: Record<string, any>;
metadata?: Record<string, any>;
}
export class Logs extends ApiResource {
exports: Exports;
constructor(client: any) {
super(client);
this.exports = new Exports(client);
}

create(
_body: LogInsertBody,
params?: ApiClientInterface,
opts?: RequestOptions
): APIPromise<any> {
const body = _body;
if (params) {
const config = overrideConfig(this.client.config, params.config);
this.client.customHeaders = {
...this.client.customHeaders,
...createHeaders({ ...params, config }),
};
}
const response = this.post<APIResponseType>(LOGS_API, {
body,
...opts,
});
return response;
}
}
export class Exports extends ApiResource {
create(
Expand Down
1 change: 1 addition & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,4 @@ export const TEXT_COMPLETE_API = '/completions';
export const PROMPT_API = '/prompt/complete';
export const FEEDBACK_API = '/feedback';
export const EMBEDDINGS_API = '/embeddings';
export const LOGS_API = '/logs';

0 comments on commit aa3b54b

Please sign in to comment.