ignore: fix dev branch (#1529)
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
import type { ModelMessage } from "ai"
|
import type { ModelMessage } from "ai"
|
||||||
import { unique } from "remeda"
|
import { unique } from "remeda"
|
||||||
|
|
||||||
|
|
||||||
export namespace ProviderTransform {
|
export namespace ProviderTransform {
|
||||||
function normalizeToolCallIds(msgs: ModelMessage[]): ModelMessage[] {
|
function normalizeToolCallIds(msgs: ModelMessage[]): ModelMessage[] {
|
||||||
return msgs.map((msg) => {
|
return msgs.map((msg) => {
|
||||||
@@ -10,7 +9,7 @@ export namespace ProviderTransform {
|
|||||||
if ((part.type === "tool-call" || part.type === "tool-result") && "toolCallId" in part) {
|
if ((part.type === "tool-call" || part.type === "tool-result") && "toolCallId" in part) {
|
||||||
return {
|
return {
|
||||||
...part,
|
...part,
|
||||||
toolCallId: part.toolCallId.replace(/[^a-zA-Z0-9_-]/g, '_')
|
toolCallId: part.toolCallId.replace(/[^a-zA-Z0-9_-]/g, "_"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return part
|
return part
|
||||||
@@ -40,8 +39,7 @@ export namespace ProviderTransform {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (const msg of unique([...system, ...final])) {
|
for (const msg of unique([...system, ...final])) {
|
||||||
const shouldUseContentOptions =
|
const shouldUseContentOptions = providerID !== "anthropic" && Array.isArray(msg.content) && msg.content.length > 0
|
||||||
providerID !== "anthropic" && Array.isArray(msg.content) && msg.content.length > 0
|
|
||||||
|
|
||||||
if (shouldUseContentOptions) {
|
if (shouldUseContentOptions) {
|
||||||
const lastContent = msg.content[msg.content.length - 1]
|
const lastContent = msg.content[msg.content.length - 1]
|
||||||
@@ -70,7 +68,7 @@ export namespace ProviderTransform {
|
|||||||
if (providerID === "anthropic" || modelID.includes("anthropic") || modelID.includes("claude")) {
|
if (providerID === "anthropic" || modelID.includes("anthropic") || modelID.includes("claude")) {
|
||||||
msgs = applyCaching(msgs, providerID)
|
msgs = applyCaching(msgs, providerID)
|
||||||
}
|
}
|
||||||
|
|
||||||
return msgs
|
return msgs
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -78,4 +76,9 @@ export namespace ProviderTransform {
|
|||||||
if (modelID.toLowerCase().includes("qwen")) return 0.55
|
if (modelID.toLowerCase().includes("qwen")) return 0.55
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function topP(_providerID: string, modelID: string) {
|
||||||
|
if (modelID.toLowerCase().includes("qwen")) return 1
|
||||||
|
return undefined
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user