diff --git a/scratch/scratch-types.ts b/scratch/scratch-types.ts deleted file mode 100644 index d295997..0000000 --- a/scratch/scratch-types.ts +++ /dev/null @@ -1,74 +0,0 @@ -import { z } from 'zod' - -// export type ChatMessageRole = 'user' | 'system' | 'assistant' -export const ChatMessageRoleSchema = z.union([ - z.literal('user'), - z.literal('system'), - z.literal('assistant'), - z.literal('function') -]) -export type ChatMessageRole = z.infer - -export interface ChatMessageBase { - role: ChatMessageRole - content: string - name?: string -} - -export interface ChatMessageUser extends ChatMessageBase { - role: 'user' -} - -export interface ChatMessageSystem extends ChatMessageBase { - role: 'system' -} - -export interface ChatMessageAssistant extends ChatMessageBase { - role: 'assistant' -} - -export interface ChatMessageFunctionCall extends ChatMessageBase { - role: 'assistant' - function_call: FunctionCall -} - -export interface FunctionCall { - name: string - arguments: string -} - -export interface ChatMessageFunction extends ChatMessageBase { - role: 'function' - name: string -} - -export type ChatMessage = - | ChatMessageUser - | ChatMessageSystem - | ChatMessageAssistant - | ChatMessageFunctionCall - | ChatMessageFunction - -export interface FunctionDefinition { - /** - * The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64. - */ - name: string - - /** - * The description of what the function does. - */ - description?: string - - /** - * The parameters the function accepts, described as a JSON Schema object. See the [guide](/docs/guides/gpt/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format. - */ - parameters?: { [key: string]: any } -} - -export type FunctionCallOptions = - | 'none' - | 'auto' - | { - name: string - } diff --git a/src/llms/openai.ts b/src/llms/openai.ts index c1b3920..ba1bcd2 100644 --- a/src/llms/openai.ts +++ b/src/llms/openai.ts @@ -78,14 +78,12 @@ export class OpenAIChatModel< ): Promise< types.BaseChatCompletionResponse > { - const res = await this._client.createChatCompletion({ + return this._client.createChatCompletion({ ...this._modelParams, model: this._model, messages, functions }) - - return res } public override clone(): OpenAIChatModel { diff --git a/src/services/weather.ts b/src/services/weather.ts index 9157eb7..dc95a7f 100644 --- a/src/services/weather.ts +++ b/src/services/weather.ts @@ -1,6 +1,6 @@ import defaultKy from 'ky' -export const WEATHER_API_BASE_URL = 'http://api.weatherapi.com/v1' +export const WEATHER_API_BASE_URL = 'https://api.weatherapi.com/v1' interface CurrentWeatherResponse { current: CurrentWeather