diff --git a/src/apis/generations.ts b/src/apis/generations.ts index c43601c..f089a9d 100644 --- a/src/apis/generations.ts +++ b/src/apis/generations.ts @@ -41,10 +41,59 @@ export interface PromptsCreateNonStreaming extends PromptBodyBase { stream?: false; } +export interface Functions { + name?: string; + description?: string; + parameters?: object; +} + +export interface Tool{ + function?: Functions; + type?: string; +} + +export interface Messages { + content?: string; + role?: string; +} + export type PromptsCreateParams = PromptsCreateNonStreaming | PromptsCreateStreaming type PromptsResponse = Record & APIResponseType; +type PromptRenderResponse = { + success: boolean; + data: { + messages?: Messages[]; + prompt?: string; + model?: string; + stream?: boolean; + suffix?: string; + max_tokens?: number; + temperature?: number; + top_k?: number; + top_p?: number; + n?: number; + stop_sequences?: string[]; + functions?: Functions[]; + function_call?: string | Functions; + logprobs?: boolean; + top_logprobs?: number; + echo?: boolean; + stop?: string | string[]; + presence_penalty?: number; + frequency_penalty?: number; + best_of?: number; + logit_bias?: { [key: string]: number }; + user?: string; + organization?: string; + tool_choice?: string; + tools?: Tool[]; + response_format?: object; + seed?: number; + }; + } & APIResponseType; + export class Prompt extends ApiResource { completions: PromptCompletions = new PromptCompletions(this.client); @@ -52,14 +101,14 @@ export class Prompt extends ApiResource { _body: PromptsCreateParams, params?: ApiClientInterface, opts?: RequestOptions - ): APIPromise { + ): APIPromise { const body = _body const promptId = _body.promptID if (params) { this.client.customHeaders = { ...this.client.customHeaders, ...createHeaders({ ...params }) } } - const response = this.post(`/prompts/${promptId}/render`, { body, ...opts }) + const response = this.post(`/prompts/${promptId}/render`, { body, ...opts }) return response } }