UNPKG

@genkit-ai/anthropic

Version:

Genkit AI framework plugin for Anthropic APIs.

44 lines (40 loc) 1.62 kB
import { AnthropicCitation } from '../../types.mjs'; import '@anthropic-ai/sdk'; import '@anthropic-ai/sdk/resources/messages'; import 'genkit'; /** * Copyright 2025 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** Structural type for Anthropic citations (works with both stable and beta APIs). */ interface AnthropicCitationInput { type: string; cited_text: string; document_index?: number; document_title?: string | null; file_id?: string | null; start_char_index?: number; end_char_index?: number; start_page_number?: number; end_page_number?: number; start_block_index?: number; end_block_index?: number; } /** * Converts Anthropic's citation format (snake_case) to genkit format (camelCase). * Only handles document-based citations (char_location, page_location, content_block_location). * Skips web search and other citation types that don't reference documents. */ declare function fromAnthropicCitation(citation: AnthropicCitationInput): AnthropicCitation | undefined; export { type AnthropicCitationInput, fromAnthropicCitation };