From b7d578eddf5a264fd454672c7c7e795188de7d07 Mon Sep 17 00:00:00 2001 From: Travis Fischer Date: Fri, 26 May 2023 17:08:56 -0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=8F=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- legacy/src/agentic.ts | 31 +++++++++++++++++++++++++++++++ legacy/src/tools/metaphor.ts | 4 ++-- 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/legacy/src/agentic.ts b/legacy/src/agentic.ts index 07da0bf4..141068b2 100644 --- a/legacy/src/agentic.ts +++ b/legacy/src/agentic.ts @@ -64,6 +64,37 @@ export class Agentic { }) } + gpt3( + promptOrChatCompletionParams: + | string + | Omit + ) { + let options: Omit + + if (typeof promptOrChatCompletionParams === 'string') { + options = { + messages: [ + { + role: 'user', + content: promptOrChatCompletionParams + } + ] + } + } else { + options = promptOrChatCompletionParams + + if (!options.messages) { + throw new Error('messages must be provided') + } + } + + return new OpenAIChatModelBuilder(this._client, { + ...(this._defaults as any), // TODO + model: 'gpt-3.5-turbo', + ...options + }) + } + gpt4( promptOrChatCompletionParams: | string diff --git a/legacy/src/tools/metaphor.ts b/legacy/src/tools/metaphor.ts index b05283b1..ed07950c 100644 --- a/legacy/src/tools/metaphor.ts +++ b/legacy/src/tools/metaphor.ts @@ -15,8 +15,8 @@ export type MetaphorSearchToolInput = z.infer< export const MetaphorSearchToolOutputSchema = z.object({ results: z.array( z.object({ - author: z.string().optional(), - dateCreated: z.string().optional(), + author: z.string().nullable(), + dateCreated: z.string().nullable(), score: z.number(), title: z.string(), url: z.string()