feat(ts-sdk): add vLLM provider (#5805)

Co-authored-by: kartik-mem0 <kartik.labhshetwar@mem0.ai>
This commit is contained in:
Barry
2026-07-06 20:23:43 +05:30
committed by GitHub
co-authored by kartik-mem0
parent b8141aaea8
commit b0bee551cb
9 changed files with 250 additions and 3 deletions
@@ -155,6 +155,35 @@ describe("ConfigManager", () => {
expect(config.llm.config.baseURL).toBe("https://api.openai.com/v1");
});
it("normalizes vllm_base_url to baseURL for vLLM", () => {
const config = ConfigManager.mergeConfig({
embedder: baseEmbedder,
vectorStore: baseVectorStore,
llm: {
provider: "vllm",
config: {
model: "Qwen/Qwen2.5-32B-Instruct",
vllm_base_url: "http://localhost:8000/v1",
},
},
});
expect(config.llm.config.baseURL).toBe("http://localhost:8000/v1");
});
it("does not inject the OpenAI baseURL default for vLLM", () => {
const config = ConfigManager.mergeConfig({
embedder: baseEmbedder,
vectorStore: baseVectorStore,
llm: {
provider: "vllm",
config: { model: "Qwen/Qwen2.5-32B-Instruct" },
},
});
expect(config.llm.config.baseURL).toBeUndefined();
});
it("should preserve url in embedder config (existing behavior)", () => {
const config = ConfigManager.mergeConfig({
embedder: {
@@ -102,6 +102,11 @@ jest.mock("../src/llms/minimax", () => ({
.fn()
.mockImplementation((config) => ({ type: "minimax-llm", config })),
}));
jest.mock("../src/llms/vllm", () => ({
VllmLLM: jest
.fn()
.mockImplementation((config) => ({ type: "vllm-llm", config })),
}));
jest.mock("../src/vector_stores/qdrant", () => ({
Qdrant: jest
@@ -228,6 +233,7 @@ describe("LLMFactory", () => {
["deepseek"],
["litellm"],
["minimax"],
["vllm"],
])("creates LLM for provider '%s'", (provider) => {
expect(() => LLMFactory.create(provider, dummyLLMConfig)).not.toThrow();
});