DdgAi 0.2.262

dotnet add package DdgAi --version 0.2.262
                    
NuGet\Install-Package DdgAi -Version 0.2.262
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="DdgAi" Version="0.2.262" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="DdgAi" Version="0.2.262" />
                    
Directory.Packages.props
<PackageReference Include="DdgAi" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add DdgAi --version 0.2.262
                    
#r "nuget: DdgAi, 0.2.262"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package DdgAi@0.2.262
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=DdgAi&version=0.2.262
                    
Install as a Cake Addin
#tool nuget:?package=DdgAi&version=0.2.262
                    
Install as a Cake Tool

DdgAiProxy

DdgAiProxy is a libary to work with Duckduckgo AI and make request with it. Also, repo contains web server to work with libary.

As Server

Not everyone familiar with C#(or other .Net languages), so, if you want, you can use it as web server with http api.

Web Api now are in early stage of development and I not reccomend to use it in production, especially if you plan to use a lot of dialogs

Docker

Docker Image Size Docker Image Version

Faster way to run it - run in docker container with

docker run -p 14532:5000 -d perdub/ddg-ai-proxy:latest

and after this you can make requests to api.

Binarys Files

If you can`t or don`t want to use Docker, you can run it as standalone application. Compile it by yourself or use autobuilded binarys from release page.

If you have installed .Net on your computer, you can download builds *-isSelfContained-false, otherwise, you should use isSelfContained-true builds which includes all stuff.

Api usage

You can use 2 different apis: custom and OpenAi-compatible. Openai-compatible api intended to use as custom endpoint, so you can replace api endpoint in any program to this api. It`s not working correctly, because by this moment implemented only /chat/completions and only with necessarily fileds in request and responce(from OpenAi OpenApi scheme).

Custom Api

For init dialog, call /base/api/init with model=0 as query param, where value it`s a Number representation | Model | Number representation | Model Name | |---|---|---| | GPT-4o mini | 0 | gpt-4o-mini | | Claude 3 Haiku | 1 | claude-3-haiku-20240307 | | Llama 3.1 70B | 2 | meta-llama/Meta-Llama-3.1-70B-Instruct-Turbo | | Mixtral 8x7B | 3 | mistralai/Mixtral-8x7B-Instruct-v0.1 |

Response will be contain a ddg-ai-proxy-guid header, which represent you dialog id. After this, call /base/api/talk with 2 query params: guid - header from previous request and message - you prompt to llm.

As Libary

NuGet Version

Adding

You can add nuget package to you project with

dotnet add package DdgAi

or go to nuget package page.

Usage

Base conservation example:

DialogManager dialogManager = new DialogManager(new CustomClient());
await dialogManager.Init(Model.Gpt3_5_turbo);
string response = await dialogManager.SendMessage("Hello! How are you? And who are you?");

Also, you can find this project at examples folder.
So, what happends here? For first, we create a DialogManager and CustomClient instancs. CustomClient is a derivative from HttpClient class, which helps us to make requests to DuckDuckGo Ai servers. With base usage like this you can don`t care about it, but if you app means usages of 2 or more DialogManager, CustomClient maybe and should be a singeltone.

After this, with CustomClient instance, we can create our DialogManager to send request to LLM. After creating, we should init dialog with Init() method. As params, it`s takes Model enum with model, which we want to use.

Now we are ready to send and response: call SendMessages(string text) and pass prompt to LLM, function will return LLM response(if all staff are not broken in this moment).

TODO:

  • refactoring libary code
  • refactoring web server code
  • add more tool to control web server(like clear old dialogs(yeah it`s not implemented now))
  • add proxy support
  • Net Standart support
  • Support things like aot and trimming
  • ???
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.2.262 446 1/23/2025
0.2.261 217 1/23/2025
0.2.224 748 12/18/2024
0.2.223 156 12/18/2024
0.2.206 222 12/4/2024
0.2.157 208 10/17/2024
0.2.154 151 10/15/2024
0.2.100 276 8/23/2024
0.2.99 180 8/23/2024
0.2.84 196 8/9/2024
0.2.83 172 8/9/2024
0.2.70 175 7/30/2024
0.2.65 136 7/26/2024
0.2.59 178 7/21/2024
0.2.56 172 7/19/2024
0.2.53 166 7/18/2024
0.2.52 154 7/18/2024
0.2.51 169 7/18/2024
0.2.50 152 7/18/2024
0.2.47 178 7/16/2024
Loading failed