cisharpai-expert

Guides implementation of Cisharpai .NET clients for OpenAI, Azure, Anthropic, and Cohere LLM providers.

Updated Jan 28, 2026
One-click install
npx skills add https://github.com/alkampfergit/cisharpai --skill cisharpai-expert-alkampfergit
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: cisharpai-expert
Source: https://github.com/alkampfergit/cisharpai/tree/main/llm/cisharpai-expert
Command: npx skills add https://github.com/alkampfergit/cisharpai --skill cisharpai-expert-alkampfergit

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Writing .NET code against multiple LLM providers means juggling different APIs, auth modes, streaming formats, and feature sets. This Skill provides expert guidance for the Cisharpai unified client library so you can configure, call, debug, and test chat, embedding, reranking, and RAG workflows across five providers without memorizing each provider's quirks. ## Core Features & Use Cases - Provider Setup & DI Registration: Covers AddOpenAiClient, AddAzureOpenAiClient, AddAnthropicClient, AddCohereChatClient, keyed services, runtime client creation via Create(...) and ICisharpaiClientFactory for multi-tenant scenarios. - Feature Interfaces: Explains the Feature Collection pattern for tool calling, JSON output, streaming, grounded chat with citations, web search, vision, image/multimodal embeddings, and Cohere reranking. - RAG Pipeline Support: Details Cisharpai.Rag chunking (fixed, semantic, recursive), bulk embedding with provider profiles, context packing, retrieval, and rank fusion. - Testing & Troubleshooting: Documents FakeChatCompletionClient, FakeEmbeddingClient, FakeRerankerClient, error handling via IsSuccess/ErrorMessage, and raw JSON debugging. - Use Case: You are building a multi-tenant ASP.NET app where each tenant supplies their own Anthropic or OpenAI key. Use this Skill to correctly register the client factory, create clients at runtime with resilience handlers, and stream responses with citations. ## Quick Start Ask the assistant to show how to register an OpenAI chat client with Cisharpai and send a first chat completion request with error handling.

Frequently Asked Questions about cisharpai-expert

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I switch LLM providers in .NET without rewriting code?▼

Cisharpai exposes shared IChatCompletionClient and IEmbeddingClient interfaces across OpenAI, Azure OpenAI, Azure AI Inference, Anthropic, and Cohere. You register a provider via DI (e.g. AddOpenAiClient or AddAnthropicClient) and application code stays unchanged when you swap providers.

How do I create Cisharpai clients at runtime with tenant API keys?▼

Use either the static Create method on each client with IHttpMessageHandlerFactory, or register ICisharpaiClientFactory with AddCisharpaiClientFactory and per-provider support. The factory takes strongly-typed configuration records like OpenAiClientConfiguration and returns IsSuccess/ErrorMessage results.

Does Cisharpai support reranking for RAG pipelines?▼

Yes, but only through Cohere via the standalone IRerankerClient interface, registered with AddCohereRerankerClient. Other providers have no rerank API. Results are ordered most-relevant-first, and each result's Index points back into your original documents array.

How do I test code that uses Cisharpai without calling real APIs?▼

Install the Cisharpai.Testing package and use FakeChatCompletionClient, FakeEmbeddingClient, or FakeRerankerClient. They support queued responses via EnqueueResponse, default responses, request capture through ReceivedRequests, and selective feature registration with FakeChatFeatures flags.

Why does my Cisharpai streaming request time out on long responses?▼

The standard AddCisharpaiResilienceHandler applies 60-second per-attempt and 90-second total timeouts, which can cut off long SSE streams. Register the streaming HttpClient with AddCisharpaiStreamingResilienceHandler instead, which keeps retries and circuit breaking but removes those timeout limits.

Which Cisharpai providers support grounded chat with citations?▼

All five providers support IGroundedChatFeature: OpenAI and Azure OpenAI natively on GPT-5 via the Responses API, Anthropic and Cohere natively on all chat models, and Azure AI Inference through a synthesized prompt-injection fallback. Citation behavior and CitationMode support vary per provider.