|
@@ -277,6 +277,25 @@ async function loadFixture(providerID: string, modelID: string) {
|
|
|
return { provider, model }
|
|
return { provider, model }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+function configModel(model: ModelsDev.Model) {
|
|
|
|
|
+ return {
|
|
|
|
|
+ id: model.id,
|
|
|
|
|
+ name: model.name,
|
|
|
|
|
+ family: model.family,
|
|
|
|
|
+ release_date: model.release_date,
|
|
|
|
|
+ attachment: model.attachment,
|
|
|
|
|
+ reasoning: model.reasoning,
|
|
|
|
|
+ temperature: model.temperature,
|
|
|
|
|
+ tool_call: model.tool_call,
|
|
|
|
|
+ interleaved: model.interleaved,
|
|
|
|
|
+ cost: model.cost ? { ...model.cost, tiers: undefined } : undefined,
|
|
|
|
|
+ limit: model.limit,
|
|
|
|
|
+ modalities: model.modalities,
|
|
|
|
|
+ status: model.status,
|
|
|
|
|
+ provider: model.provider,
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
function createEventStream(chunks: unknown[], includeDone = false) {
|
|
function createEventStream(chunks: unknown[], includeDone = false) {
|
|
|
const lines = chunks.map((chunk) => `data: ${typeof chunk === "string" ? chunk : JSON.stringify(chunk)}`)
|
|
const lines = chunks.map((chunk) => `data: ${typeof chunk === "string" ? chunk : JSON.stringify(chunk)}`)
|
|
|
if (includeDone) {
|
|
if (includeDone) {
|
|
@@ -617,7 +636,7 @@ describe("session.llm.stream", () => {
|
|
|
npm: "@ai-sdk/openai",
|
|
npm: "@ai-sdk/openai",
|
|
|
api: "https://api.openai.com/v1",
|
|
api: "https://api.openai.com/v1",
|
|
|
models: {
|
|
models: {
|
|
|
- [model.id]: model,
|
|
|
|
|
|
|
+ [model.id]: configModel(model),
|
|
|
},
|
|
},
|
|
|
options: {
|
|
options: {
|
|
|
apiKey: "test-openai-key",
|
|
apiKey: "test-openai-key",
|
|
@@ -733,7 +752,7 @@ describe("session.llm.stream", () => {
|
|
|
npm: "@ai-sdk/openai",
|
|
npm: "@ai-sdk/openai",
|
|
|
api: "https://api.openai.com/v1",
|
|
api: "https://api.openai.com/v1",
|
|
|
models: {
|
|
models: {
|
|
|
- [model.id]: model,
|
|
|
|
|
|
|
+ [model.id]: configModel(model),
|
|
|
},
|
|
},
|
|
|
options: {
|
|
options: {
|
|
|
apiKey: "test-openai-key",
|
|
apiKey: "test-openai-key",
|
|
@@ -970,7 +989,7 @@ describe("session.llm.stream", () => {
|
|
|
npm: "@ai-sdk/anthropic",
|
|
npm: "@ai-sdk/anthropic",
|
|
|
api: "https://api.anthropic.com/v1",
|
|
api: "https://api.anthropic.com/v1",
|
|
|
models: {
|
|
models: {
|
|
|
- [model.id]: model,
|
|
|
|
|
|
|
+ [model.id]: configModel(model),
|
|
|
},
|
|
},
|
|
|
options: {
|
|
options: {
|
|
|
apiKey: "test-anthropic-key",
|
|
apiKey: "test-anthropic-key",
|