AnthropicContentConverter (anthropicContentGenerator/converter.ts)

qwen-code · packages/core/src/core/anthropicContentGenerator/converter.ts · typescript · Apache-2.0
ai, tag:knn-classified

Converts content for Anthropic models, handling cache control and tool calls.

// Source: https://github.com/QwenLM/qwen-code | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
/**
 * @license
 * Copyright 2025 Qwen
 * SPDX-License-Identifier: Apache-2.0
 */

import type {
  Candidate,
  CallableTool,
  Content,
  ContentListUnion,
  ContentUnion,
  FunctionResponse,
  GenerateContentParameters,
  Part,
  PartUnion,
  Tool,
  ToolListUnion,
} from '@google/genai';
import { FinishReason, GenerateContentResponse } from '@google/genai';
import { buildAnthropicUsageMetadata } from './usage.js';
import type Anthropic from '@anthropic-ai/sdk';
import { safeJsonParse } from '../../utils/safeJsonParse.js';
import {
  convertSchema,
  type SchemaComplianceMode,
} from '

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key