DdgAi 0.2.262
dotnet add package DdgAi --version 0.2.262
NuGet\Install-Package DdgAi -Version 0.2.262
<PackageReference Include="DdgAi" Version="0.2.262" />
<PackageVersion Include="DdgAi" Version="0.2.262" />
<PackageReference Include="DdgAi" />
paket add DdgAi --version 0.2.262
#r "nuget: DdgAi, 0.2.262"
#:package DdgAi@0.2.262
#addin nuget:?package=DdgAi&version=0.2.262
#tool nuget:?package=DdgAi&version=0.2.262
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
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
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 | Versions 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. |
-
.NETStandard 2.0
- System.Text.Json (>= 8.0.5)
-
net8.0
- System.Text.Json (>= 8.0.5)
-
net9.0
- System.Text.Json (>= 8.0.5)
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 |