Revert "Anthropic: Bump it up! (#1938)"

This reverts commit c2809491b4.
This commit is contained in:
Saoud Rizwan committed 2025-02-24 18:09:51 -08:00
1 parent c2809491b4
commit 131b245023
10 files changed
+33 -48

No files matched your search

+11 -4
View File
@@ -11,7 +11,16 @@ import {
TextPart,
} from "@google/generative-ai"
export function convertAnthropicContentToGemini(content: string | Anthropic.ContentBlockParam[]): Part[] {
export function convertAnthropicContentToGemini(
content:
| string
| Array<
| Anthropic.Messages.TextBlockParam
| Anthropic.Messages.ImageBlockParam
| Anthropic.Messages.ToolUseBlockParam
| Anthropic.Messages.ToolResultBlockParam
>,
): Part[] {
if (typeof content === "string") {
return [{ text: content } as TextPart]
}
@@ -124,7 +133,7 @@ export function convertGeminiResponseToAnthropic(response: EnhancedGenerateConte
// Add the main text response
const text = response.text()
if (text) {
content.push({ type: "text", text, citations: null })
content.push({ type: "text", text })
}
// Add function calls as tool_use blocks
@@ -174,8 +183,6 @@ export function convertGeminiResponseToAnthropic(response: EnhancedGenerateConte
usage: {
input_tokens: response.usageMetadata?.promptTokenCount ?? 0,
output_tokens: response.usageMetadata?.candidatesTokenCount ?? 0,
cache_creation_input_tokens: null,
cache_read_input_tokens: null,
},
}
}
-3
View File
@@ -376,7 +376,6 @@ export function convertO1ResponseToAnthropicMessage(
{
type: "text",
text: normalText,
citations: null,
},
],
model: completion.model,
@@ -397,8 +396,6 @@ export function convertO1ResponseToAnthropicMessage(
usage: {
input_tokens: completion.usage?.prompt_tokens || 0,
output_tokens: completion.usage?.completion_tokens || 0,
cache_creation_input_tokens: null,
cache_read_input_tokens: null,
},
}
-3
View File
@@ -161,7 +161,6 @@ export function convertToAnthropicMessage(completion: OpenAI.Chat.Completions.Ch
{
type: "text",
text: openAiMessage.content || "",
citations: null,
},
],
model: completion.model,
@@ -182,8 +181,6 @@ export function convertToAnthropicMessage(completion: OpenAI.Chat.Completions.Ch
usage: {
input_tokens: completion.usage?.prompt_tokens || 0,
output_tokens: completion.usage?.completion_tokens || 0,
cache_creation_input_tokens: null,
cache_read_input_tokens: null,
},
}
-3
View File
@@ -175,7 +175,6 @@ export async function convertToAnthropicMessage(
return {
type: "text",
text: part.value,
citations: null,
}
}
@@ -196,8 +195,6 @@ export async function convertToAnthropicMessage(
usage: {
input_tokens: 0,
output_tokens: 0,
cache_creation_input_tokens: null,
cache_read_input_tokens: null,
},
}
}