chore: format

This commit is contained in:
Nate 2025-08-20 21:12:31 -07:00
parent ccb01f6643
commit dde2489c73
4 changed files with 21 additions and 5 deletions

View file

@ -194,7 +194,10 @@ export function fromChatCompletionChunk(
role: "assistant",
content: "",
toolCalls: delta?.tool_calls
.filter((tool_call) => tool_call.type === "function" && "function" in tool_call)
.filter(
(tool_call) =>
tool_call.type === "function" && "function" in tool_call,
)
.map((tool_call) => ({
id: tool_call.id,
type: "function" as const,

View file

@ -250,7 +250,12 @@ export class BedrockApi implements BaseLlmApi {
if (message.tool_calls) {
for (const toolCall of message.tool_calls) {
// Type guard for function tool calls
if (toolCall.type === "function" && "function" in toolCall && toolCall.id && toolCall.function?.name) {
if (
toolCall.type === "function" &&
"function" in toolCall &&
toolCall.id &&
toolCall.function?.name
) {
if (availableTools.has(toolCall.function.name)) {
currentBlocks.push({
toolUse: {
@ -270,7 +275,9 @@ export class BedrockApi implements BaseLlmApi {
});
}
} else {
console.warn(`Unsupported tool call type in Bedrock: ${toolCall.type}`);
console.warn(
`Unsupported tool call type in Bedrock: ${toolCall.type}`,
);
}
}
}

View file

@ -150,7 +150,9 @@ export class GeminiApi implements BaseLlmApi {
},
};
} else {
throw new Error(`Unsupported tool call type in Gemini: ${toolCall.type}`);
throw new Error(
`Unsupported tool call type in Gemini: ${toolCall.type}`,
);
}
}),
};

View file

@ -102,7 +102,11 @@ function assertFetchCall(mockFetch: any, expectedRequest: any) {
if (expectedRequest.headers) {
// Handle both plain objects and Headers objects
const actualHeaders = options.headers;
if (actualHeaders && typeof actualHeaders === 'object' && 'get' in actualHeaders) {
if (
actualHeaders &&
typeof actualHeaders === "object" &&
"get" in actualHeaders
) {
// This is a Headers-like object, convert to plain object for comparison
const headersObj: Record<string, string> = {};
for (const key of Object.keys(expectedRequest.headers)) {