feat(opencode): configure Cohere North model (#31536)
This commit is contained in:
@@ -478,6 +478,7 @@ export function message(msgs: ModelMessage[], model: Provider.Model, options: Re
|
|||||||
|
|
||||||
export function temperature(model: Provider.Model) {
|
export function temperature(model: Provider.Model) {
|
||||||
const id = model.id.toLowerCase()
|
const id = model.id.toLowerCase()
|
||||||
|
if (id.includes("north-mini-code")) return 1.0
|
||||||
if (id.includes("qwen")) return 0.55
|
if (id.includes("qwen")) return 0.55
|
||||||
if (id.includes("claude")) return undefined
|
if (id.includes("claude")) return undefined
|
||||||
if (id.includes("gemini")) return 1.0
|
if (id.includes("gemini")) return 1.0
|
||||||
@@ -826,6 +827,9 @@ export function variants(model: Provider.Model): Record<string, Record<string, a
|
|||||||
case "venice-ai-sdk-provider":
|
case "venice-ai-sdk-provider":
|
||||||
// https://docs.venice.ai/overview/guides/reasoning-models#reasoning-effort
|
// https://docs.venice.ai/overview/guides/reasoning-models#reasoning-effort
|
||||||
case "@ai-sdk/openai-compatible":
|
case "@ai-sdk/openai-compatible":
|
||||||
|
if (model.api.id.toLowerCase().includes("north-mini-code")) {
|
||||||
|
return Object.fromEntries(["none", "high"].map((effort) => [effort, { reasoningEffort: effort }]))
|
||||||
|
}
|
||||||
const efforts = [...WIDELY_SUPPORTED_EFFORTS]
|
const efforts = [...WIDELY_SUPPORTED_EFFORTS]
|
||||||
if (model.api.id.toLowerCase().includes("deepseek-v4")) {
|
if (model.api.id.toLowerCase().includes("deepseek-v4")) {
|
||||||
efforts.push("max")
|
efforts.push("max")
|
||||||
@@ -1105,6 +1109,10 @@ export function options(input: {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const modelId = input.model.api.id.toLowerCase()
|
const modelId = input.model.api.id.toLowerCase()
|
||||||
|
if (modelId.includes("north-mini-code") && input.model.api.npm === "@ai-sdk/openai-compatible") {
|
||||||
|
result["options"] = { citation_options: { mode: "disabled" } }
|
||||||
|
}
|
||||||
|
|
||||||
// MiniMax's Anthropic interface defaults thinking off, unlike Chat Completions.
|
// MiniMax's Anthropic interface defaults thinking off, unlike Chat Completions.
|
||||||
if (modelId.includes("minimax-m3") && input.model.api.npm === "@ai-sdk/anthropic") {
|
if (modelId.includes("minimax-m3") && input.model.api.npm === "@ai-sdk/anthropic") {
|
||||||
result["thinking"] = { type: "adaptive" }
|
result["thinking"] = { type: "adaptive" }
|
||||||
|
|||||||
@@ -2483,6 +2483,31 @@ describe("ProviderTransform.message - cache control on gateway", () => {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
describe("ProviderTransform.options - Cohere North", () => {
|
||||||
|
test("disables citations by default for north-mini-code-1-0", () => {
|
||||||
|
const result = ProviderTransform.options({
|
||||||
|
model: {
|
||||||
|
id: "cohere/north-mini-code-1-0",
|
||||||
|
providerID: "cohere",
|
||||||
|
api: {
|
||||||
|
id: "North-Mini-Code-1-0-latest",
|
||||||
|
url: "https://api.cohere.com/compatibility/v1",
|
||||||
|
npm: "@ai-sdk/openai-compatible",
|
||||||
|
},
|
||||||
|
capabilities: { reasoning: true },
|
||||||
|
} as any,
|
||||||
|
sessionID: "test-session-123",
|
||||||
|
})
|
||||||
|
expect(result.options).toEqual({ citation_options: { mode: "disabled" } })
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
describe("ProviderTransform.temperature - Cohere North", () => {
|
||||||
|
test("defaults north-mini-code models to 1.0", () => {
|
||||||
|
expect(ProviderTransform.temperature({ id: "cohere/North-Mini-Code-1-0-latest" } as any)).toBe(1.0)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
describe("ProviderTransform.variants", () => {
|
describe("ProviderTransform.variants", () => {
|
||||||
const createMockModel = (overrides: Partial<any> = {}): any => ({
|
const createMockModel = (overrides: Partial<any> = {}): any => ({
|
||||||
id: "test/test-model",
|
id: "test/test-model",
|
||||||
@@ -3209,6 +3234,23 @@ describe("ProviderTransform.variants", () => {
|
|||||||
expect(result.low).toEqual({ reasoningEffort: "low" })
|
expect(result.low).toEqual({ reasoningEffort: "low" })
|
||||||
expect(result.high).toEqual({ reasoningEffort: "high" })
|
expect(result.high).toEqual({ reasoningEffort: "high" })
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test("north-mini-code-1-0 returns only none and high", () => {
|
||||||
|
const model = createMockModel({
|
||||||
|
id: "cohere/north-mini-code-1-0",
|
||||||
|
providerID: "cohere",
|
||||||
|
api: {
|
||||||
|
id: "North-Mini-Code-1-0-latest",
|
||||||
|
url: "https://api.cohere.com/compatibility/v1",
|
||||||
|
npm: "@ai-sdk/openai-compatible",
|
||||||
|
},
|
||||||
|
})
|
||||||
|
const result = ProviderTransform.variants(model)
|
||||||
|
expect(result).toEqual({
|
||||||
|
none: { reasoningEffort: "none" },
|
||||||
|
high: { reasoningEffort: "high" },
|
||||||
|
})
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe("@ai-sdk/azure", () => {
|
describe("@ai-sdk/azure", () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user