Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time


tests docs License: Apache 2.0 @DotnetPrompt

Quick Start

DotnetPrompt is a dotnet library that provides tools for working with Large Language Models (LLMs) individually and combined in chains. Our library helps you integrate LLMs with other tools and resources to create powerful AI applications.

To get started, add NuGet meta-package

> dotnet add package DotnetPrompt.All --version 1.0.0-alpha.2

For example, let's say we want to create a ModelChain that takes user message, formats it with a PromptTemplate, and sends it to an ChatGPT LLM to generate funny responses to the message. This allows us to generate a response based on the user's input.

Note: For that example to work you would need OpenAI API key.

var llm = new ChatGptModel(Constants.OpenAIKey, ChatGptModelConfiguration.Default with
            Temperature = 0.9f

var oneInputPrompt = new PromptTemplate("What's a funny response to '{message}'");

var chain = new ModelChain(oneInputPrompt, llm);
var executor = chain.GetExecutor();

Now we can run that chain only specifying input value.

var result = await executor.PromptAsync("I have some exciting news to share with you!");
> I hope it's not that you finally learned how to tie your shoes, because that's not that exciting.

Or with another input

var result2 = await executor.PromptAsync("Want to grab lunch later?");
> I would, but I'm on a "seefood" diet - I see food and I eat it. So better not tempt me!

What is this?

Welcome to our library, which is designed to support the development of cutting-edge applications powered by Large Language Models (LLMs) in dotnet.

As you may know, LLMs are an exciting and rapidly-evolving technology that offers developers unprecedented natural language processing and generation capabilities. However, LLMs can achieve their full potential when used in conjunction with other sources of computation or knowledge.

Some examples of solutions that you could create using our library include:

  • Summarization
  • Question Answering
  • Code Generation
  • Chatbots
  • and much more


Please see the full documentation on:

  • Getting started (installation, setting up the environment, simple examples)
  • How-To examples (demos, integrations, helper functions)
  • Reference (full API docs)
  • Resources (high-level explanation of core concepts)

Important Milestones

We are actively developing this library, while it already has a lot of useful funtionalty, much more would be introduced in the future.

  • Porting tiktoken and huggingface tokenizers to support more models, currently there is a partial support
  • Streaming (using SignalR maybe?)
  • VectorDB support
  • Context Window Management
  • ML.NET Agents/Chains/Integrations (is there anything good?)
  • More end-to-end examples

A full roadmap is availible here

Contributing to DotnetPrompt

We welcome contributions to DotnetPrompt! To ensure that your contributions are effective and easy to incorporate, please follow these guidelines.


Unlock the full potential of large language models in dotnet with DotnetPrompt