fix: pr feedback

old-agentic-v1^2
Travis Fischer 2023-06-14 15:20:09 -07:00
rodzic 5274123343
commit efc149a7b5
3 zmienionych plików z 2 dodań i 78 usunięć

Wyświetl plik

@ -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<typeof ChatMessageRoleSchema>
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
}

Wyświetl plik

@ -78,14 +78,12 @@ export class OpenAIChatModel<
): Promise<
types.BaseChatCompletionResponse<types.openai.ChatCompletionResponse>
> {
const res = await this._client.createChatCompletion({
return this._client.createChatCompletion({
...this._modelParams,
model: this._model,
messages,
functions
})
return res
}
public override clone(): OpenAIChatModel<TInput, TOutput> {

Wyświetl plik

@ -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