Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Insert Log #145

Merged
merged 1 commit into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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';
Loading