Skip to content

Generated C# SDK based on official Anthropic OpenAPI specification

License

Notifications You must be signed in to change notification settings

ciprian-aw/Anthropic.Client

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Anthropic

Nuget package dotnet License: MIT Discord

Generated C# SDK based on official Anthropic OpenAPI specification using NSwag.
Includes tokenizer and some helper methods.

Usage

using Anthropic;

using var client = new HttpClient();
var api = new AnthropicApi(apiKey, client);
var response = await api.CompleteAsync(new CreateCompletionRequest
{
    Model = ModelIds.ClaudeInstant,
    Prompt = "Once upon a time".AsPrompt(),
    Max_tokens_to_sample = 250,
});
Console.WriteLine(response.Completion);

// or use history syntax

var response = await api.CompleteAsync(new CreateCompletionRequest
{
    Model = ModelIds.ClaudeInstant,
    Prompt = new[]
    {
        "What's the weather like today?".AsHumanMessage(),
        "Sure! Could you please provide me with your location?".AsAssistantMessage(),
        "Dubai, UAE".AsHumanMessage(),
    }.AsPrompt(),
    Max_tokens_to_sample = 300,
});

Support

Priority place for bugs: https://github.com/tryAGI/Anthropic/issues
Priority place for ideas and general questions: https://github.com/tryAGI/Anthropic/discussions
Discord: https://discord.gg/Ca2xhfBf3v

About

Generated C# SDK based on official Anthropic OpenAPI specification

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 100.0%