instructor-js icon indicating copy to clipboard operation
instructor-js copied to clipboard

Type Issue using anthropic through llm-polyglot

Open bbauman1 opened this issue 1 year ago • 1 comments

I believe I'm following the documentation exactly, but receiving a typing error. Am I doing something wrong?

Type 'Anthropic & { [key: string]: unknown; chat: { completions: { create: <P extends AnthropicChatCompletionParams>(params: P) => P extends { stream: true; } ? Promise<...> : Promise<...>; }; }; }' does not satisfy the constraint 'OpenAI | GenericClient'.
  Type 'Anthropic & { [key: string]: unknown; chat: { completions: { create: <P extends AnthropicChatCompletionParams>(params: P) => P extends { stream: true; } ? Promise<...> : Promise<...>; }; }; }' is missing the following properties from type 'OpenAI': organization, project, embeddings, files, and 6 more.ts(2344)
const anthropicClient: Anthropic & {
    [key: string]: unknown;
    chat: {
        completions: {
            create: <P extends AnthropicChatCompletionParams>(params: P) => P extends {
                stream: true;
            } ? Promise<...> : Promise<...>;
        };
    };
}

CleanShot 2024-05-08 at 12 06 15@2x

bbauman1 avatar May 08 '24 19:05 bbauman1

what versions of each package are you on?

roodboi avatar May 17 '24 16:05 roodboi

I'm seeing this issue with:

@anthropic-ai/sdk 0.21.1
@instructor-ai/instructor 1.3.0
llm-polyglot 1.0.0

Also had the same issue with previous versions of @anthropic-ai/sdk (0.20.x) and @instructor-ai/instructor (1.2.1).

pdlug avatar May 23 '24 12:05 pdlug