diff --git a/docs/changelog.mdx b/docs/changelog.mdx index 6f21e8cb..cc6ab63a 100644 --- a/docs/changelog.mdx +++ b/docs/changelog.mdx @@ -288,6 +288,11 @@ mode: "wide" + +**Improvements:** +- **OSS:** Added baseURL param in LLM Config. + + **Improvements:** - **Client:** Removed type `string` from `messages` interface diff --git a/mem0-ts/package.json b/mem0-ts/package.json index 6c629a9d..7c53677c 100644 --- a/mem0-ts/package.json +++ b/mem0-ts/package.json @@ -1,6 +1,6 @@ { "name": "mem0ai", - "version": "2.1.26", + "version": "2.1.27", "description": "The Memory Layer For Your AI Apps", "main": "./dist/index.js", "module": "./dist/index.mjs", diff --git a/mem0-ts/src/oss/src/config/defaults.ts b/mem0-ts/src/oss/src/config/defaults.ts index b2c9d19f..ae2a514b 100644 --- a/mem0-ts/src/oss/src/config/defaults.ts +++ b/mem0-ts/src/oss/src/config/defaults.ts @@ -20,6 +20,7 @@ export const DEFAULT_MEMORY_CONFIG: MemoryConfig = { llm: { provider: "openai", config: { + baseURL: "https://api.openai.com/v1", apiKey: process.env.OPENAI_API_KEY || "", model: "gpt-4-turbo-preview", modelProperties: undefined, diff --git a/mem0-ts/src/oss/src/config/manager.ts b/mem0-ts/src/oss/src/config/manager.ts index 9371b705..01996e0f 100644 --- a/mem0-ts/src/oss/src/config/manager.ts +++ b/mem0-ts/src/oss/src/config/manager.ts @@ -78,8 +78,9 @@ export class ConfigManager { } else if (userConf?.model && typeof userConf.model === "string") { finalModel = userConf.model; } - + return { + baseURL: userConf?.baseURL || defaultConf.baseURL, apiKey: userConf?.apiKey !== undefined ? userConf.apiKey diff --git a/mem0-ts/src/oss/src/llms/openai.ts b/mem0-ts/src/oss/src/llms/openai.ts index d1e148f5..2d448fb3 100644 --- a/mem0-ts/src/oss/src/llms/openai.ts +++ b/mem0-ts/src/oss/src/llms/openai.ts @@ -7,7 +7,7 @@ export class OpenAILLM implements LLM { private model: string; constructor(config: LLMConfig) { - this.openai = new OpenAI({ apiKey: config.apiKey }); + this.openai = new OpenAI({ apiKey: config.apiKey, baseURL: config.baseURL }); this.model = config.model || "gpt-4o-mini"; } diff --git a/mem0-ts/src/oss/src/types/index.ts b/mem0-ts/src/oss/src/types/index.ts index aa2d5d73..b2bdc0a8 100644 --- a/mem0-ts/src/oss/src/types/index.ts +++ b/mem0-ts/src/oss/src/types/index.ts @@ -39,6 +39,7 @@ export interface HistoryStoreConfig { export interface LLMConfig { provider?: string; + baseURL?: string; config?: Record; apiKey?: string; model?: string | any;