diff --git a/src/api/providers/__tests__/sambanova.spec.ts b/src/api/providers/__tests__/sambanova.spec.ts index 685cedf34c..34d51a3db4 100644 --- a/src/api/providers/__tests__/sambanova.spec.ts +++ b/src/api/providers/__tests__/sambanova.spec.ts @@ -113,7 +113,7 @@ describe("SambaNovaHandler", () => { expect(firstChunk.value).toMatchObject({ type: "usage", inputTokens: 10, outputTokens: 20 }) }) - it("createMessage should pass correct parameters to SambaNova client", async () => { + it("createMessage should pass correct parameters to SambaNova client without stream_options", async () => { const modelId: SambaNovaModelId = "Meta-Llama-3.3-70B-Instruct" const modelInfo = sambaNovaModels[modelId] const handlerWithModel = new SambaNovaHandler({ @@ -137,6 +137,7 @@ describe("SambaNovaHandler", () => { const messageGenerator = handlerWithModel.createMessage(systemPrompt, messages) await messageGenerator.next() + // Verify that stream_options is NOT included in the request expect(mockCreate).toHaveBeenCalledWith( expect.objectContaining({ model: modelId, @@ -144,9 +145,12 @@ describe("SambaNovaHandler", () => { temperature: 0.7, messages: expect.arrayContaining([{ role: "system", content: systemPrompt }]), stream: true, - stream_options: { include_usage: true }, }), undefined, ) + + // Explicitly verify stream_options is not present + const callArgs = mockCreate.mock.calls[0][0] + expect(callArgs).not.toHaveProperty("stream_options") }) }) diff --git a/src/api/providers/sambanova.ts b/src/api/providers/sambanova.ts index a15bc12577..150eec6af0 100644 --- a/src/api/providers/sambanova.ts +++ b/src/api/providers/sambanova.ts @@ -1,6 +1,12 @@ +import { Anthropic } from "@anthropic-ai/sdk" +import OpenAI from "openai" + import { type SambaNovaModelId, sambaNovaDefaultModelId, sambaNovaModels } from "@roo-code/types" import type { ApiHandlerOptions } from "../../shared/api" +import { getModelMaxOutputTokens } from "../../shared/api" +import { convertToOpenAiMessages } from "../transform/openai-format" +import type { ApiHandlerCreateMessageMetadata } from "../index" import { BaseOpenAiCompatibleProvider } from "./base-openai-compatible-provider" @@ -16,4 +22,48 @@ export class SambaNovaHandler extends BaseOpenAiCompatibleProvider