Skip to content

Latest commit

 

History

History
129 lines (112 loc) · 4.35 KB

File metadata and controls

129 lines (112 loc) · 4.35 KB

Zatomic.AI.Providers

C# .NET library that provides chat functionality for the following AI providers: Amazon Bedrock, Anthropic, Cohere, Databricks, Deep Infra, Fireworks AI, Google Gemini, Groq, Hugging Face, IBM WatsonX, Inception, Microsoft Foundry, Mistral, Moonshot AI, Nvidia, OpenAI, Perplexity, Together AI, and xAI.

The library calls the chat completions REST APIs and inference endpoints for each of the above AI providers. Everything is strongly-typed with the library handling all JSON serialization/deserialization for all requests and responses. Both non-stream and streaming functionality is supported using async methods for improved performance, and each client utilizes exponential retries to handle 429 Too Many Requests responses.

Requirements

Currently, only .net10 is supported.

Installation

Using the .NET CLI:

dotnet add package Zatomic.AI.Providers

Using the NuGet CLI:

nuget install Zatomic.AI.Providers

Using the Package Manager console:

Install-Package Zatomic.AI.Providers

From within Visual Studio:

  1. Open the Solution Explorer.
  2. Right-click on a project within your solution.
  3. Click on Manage NuGet Packages...
  4. Click on the Browse tab and search for "Zatomic.AI.Providers".
  5. Click on the Zatomic.AI.Providers package, select the appropriate version in the right-pane, click Install.

Samples

Samples for all AI providers can be found in the src/Zatomic.AI.Providers.Samples project. This is an NUnit test project, but that's simply to make it easy to run/debug the sample methods. Before running any of the sample methods, you must add an AppSettings.Development.json file to the root of the project. This file should contain the API keys, models, etc for the providers you want to run against.

The format of the AppSettigns.Development.json file is as follows:

{
    "AmazonBedrock": {
        "AccessKey": "",
        "SecretKey": "",
        "Region": "",
        "Model": ""
    },
    "Anthropic": {
        "ApiKey": "",
        "Model": "",
        "MaxTokens": ""
    },
    "Cohere": {
        "ApiKey": "",
        "Model": ""
    },
    "Databricks": {
        "ApiKey": "",
        "ApiUrl": ""
    },
    "DeepInfra": {
        "ApiKey": "",
        "Model": ""
    },
    "FireworksAI": {
        "ApiKey": "",
        "Model": ""
    },
    "GoogleGemini": {
        "ApiKey": "",
        "Model": ""
    },
    "Groq": {
        "ApiKey": "",
        "Model": ""
    },
    "HuggingFace": {
        "AccessToken": "",
        "Endpoint": "",
        "Model": ""
    },
    "IbmWatsonX": {
        "AccessToken": "",
        "ModelId": "",
        "ProjectId": ""
	},
    "Inception": {
        "ApiKey": "",
        "Model": ""
    },
    "MicrosoftFoundry": {
        "ApiKey": "",
        "Model": ""
    },
    "Mistral": {
        "ApiKey": "",
        "Model": ""
    },
    "MoonshotAI": {
        "ApiKey": "",
        "Model": ""
    },
    "Nvidia": {
        "ApiKey": "",
        "Model": ""
    },
    "OpenAI": {
        "ApiKey": "",
        "Model": ""
    },
    "Perplexity": {
        "ApiKey": "",
        "Model": ""
    },
    "TogetherAI": {
        "ApiKey": "",
        "Model": ""
    },
    "xAI": {
        "ApiKey": "",
        "Model": ""
    }
}