From 02a5b0f7b97cc71e61f7fd811ec652a4995315cf Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Wed, 13 Dec 2023 17:42:59 +0100 Subject: [PATCH] Remove getTime model function it lead to higher usage of tokens. --- src/configDefault.ts | 10 ---------- src/funcitonManager.ts | 19 +------------------ 2 files changed, 1 insertion(+), 28 deletions(-) diff --git a/src/configDefault.ts b/src/configDefault.ts index 65785a9..12ce515 100644 --- a/src/configDefault.ts +++ b/src/configDefault.ts @@ -8,7 +8,6 @@ import IQuota from "./IQuota"; import MessageCount from "./quota/messageCount"; export interface IConfigRequired { - readonly calendarParams: Intl.DateTimeFormatOptions; /** Tokens to authentiate with */ readonly tokens: { readonly Discord: string; @@ -52,15 +51,6 @@ function envAsNumber(key: string): number | undefined { } const defaultConfig: IConfigRequired = { - calendarParams: { - weekday: "short", - year: "numeric", - month: "short", - day: "numeric", - hour: "2-digit", - minute: "2-digit", - hour12: false, - }, tokens: { Discord: envAsString("TOKENS__DISCORD") ?? "", OpenAI: envAsString("TOKENS__OPENAI") ?? "", diff --git a/src/funcitonManager.ts b/src/funcitonManager.ts index 9bcb0ec..41e35c1 100644 --- a/src/funcitonManager.ts +++ b/src/funcitonManager.ts @@ -1,7 +1,5 @@ import { ChatCompletionCreateParams, ChatCompletionMessage, ChatCompletionMessageParam } from "openai/resources/chat"; -import { config } from "./index"; - type parameterMap = { string: string, number: number, @@ -53,7 +51,7 @@ export default class FunctionManager { store = new Map(); constructor() { - this.store.set("getTime", new GetTime()); + // TODO: import functions from functions directory } public getFunctions(): ChatCompletionFunctions[] { @@ -95,18 +93,3 @@ export default class FunctionManager { }; } } - -// buildins - -class GetTime extends OpenAIFunction> { - name = "getTime"; - description = "Gets current date and time with a timezone attached"; - parameters = { - type: "object" as const, - properties: {} as Record, - }; - - execute(): string { - return `${Intl.DateTimeFormat().resolvedOptions().timeZone}): ${new Date().toLocaleString("en-US", config.calendarParams)}`; - } -}