Skip to content

Commit

Permalink
feat: Initial commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
HavenDV committed May 10, 2024
1 parent 73d40a4 commit 0d9e76f
Show file tree
Hide file tree
Showing 15 changed files with 1,150 additions and 2 deletions.
15 changes: 15 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "nuget" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
groups:
all:
patterns:
- "*"
17 changes: 17 additions & 0 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Build, test and publish
on:
push:
branches:
- main

jobs:
build-test-publish:
name: Build, test and publish
uses: HavenDV/workflows/.github/workflows/dotnet_build-test-publish.yml@main
with:
generate-build-number: false
conventional-commits-publish-conditions: false
enable-caching: false
additional-test-arguments: '--logger GitHubActions'
secrets:
nuget-key: ${{ secrets.NUGET_KEY }}
15 changes: 15 additions & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Build and test
on:
pull_request:
branches:
- main

jobs:
build-test:
name: Build abd test
uses: HavenDV/workflows/.github/workflows/dotnet_build-test-publish.yml@main
with:
generate-build-number: false
conventional-commits-publish-conditions: false
enable-caching: false
additional-test-arguments: '--logger GitHubActions'
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -396,3 +396,4 @@ FodyWeavers.xsd

# JetBrains Rider
*.sln.iml
/.idea/
53 changes: 53 additions & 0 deletions Ollama.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30204.135
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{E793AF18-4371-4EBD-96FC-195EB1798855}"
ProjectSection(SolutionItems) = preProject
.gitignore = .gitignore
src\Directory.Build.props = src\Directory.Build.props
.github\workflows\dotnet.yml = .github\workflows\dotnet.yml
LICENSE = LICENSE
docs\openapi.yaml = docs\openapi.yaml
README.md = README.md
.github\workflows\pull-request.yml = .github\workflows\pull-request.yml
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "libs", "libs", "{61E7E11E-4558-434C-ACE8-06316A3097B3}"
ProjectSection(SolutionItems) = preProject
src\libs\Directory.Build.props = src\libs\Directory.Build.props
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{AAA11B78-2764-4520-A97E-46AA7089A588}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ollama", "src\libs\Ollama\Ollama.csproj", "{0028BC85-0064-4CE8-A21A-C1F5E922BD59}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ollama.IntegrationTests", "src\tests\Ollama.IntegrationTests\Ollama.IntegrationTests.csproj", "{2C15EAC0-08E6-447A-84E2-1398DDE358AC}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{0028BC85-0064-4CE8-A21A-C1F5E922BD59}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0028BC85-0064-4CE8-A21A-C1F5E922BD59}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0028BC85-0064-4CE8-A21A-C1F5E922BD59}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0028BC85-0064-4CE8-A21A-C1F5E922BD59}.Release|Any CPU.Build.0 = Release|Any CPU
{2C15EAC0-08E6-447A-84E2-1398DDE358AC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2C15EAC0-08E6-447A-84E2-1398DDE358AC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2C15EAC0-08E6-447A-84E2-1398DDE358AC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2C15EAC0-08E6-447A-84E2-1398DDE358AC}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{0028BC85-0064-4CE8-A21A-C1F5E922BD59} = {61E7E11E-4558-434C-ACE8-06316A3097B3}
{2C15EAC0-08E6-447A-84E2-1398DDE358AC} = {AAA11B78-2764-4520-A97E-46AA7089A588}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {CED9A020-DBA5-4BE6-8096-75E528648EC1}
EndGlobalSection
EndGlobal
45 changes: 43 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,43 @@
# Ollama
Ollama SDK for .NET
# Ollama SDK for .NET

[![Nuget package](https://img.shields.io/nuget/vpre/Ollama)](https://www.nuget.org/packages/Ollama/)
[![dotnet](https://github.com/tryAGI/Ollama/actions/workflows/dotnet.yml/badge.svg?branch=main)](https://github.com/tryAGI/Ollama/actions/workflows/dotnet.yml)
[![License: MIT](https://img.shields.io/github/license/tryAGI/Ollama)](https://github.com/tryAGI/Ollama/blob/main/LICENSE.txt)
[![Discord](https://img.shields.io/discord/1115206893015662663?label=Discord&logo=discord&logoColor=white&color=d82679)](https://discord.gg/Ca2xhfBf3v)

Generated C# SDK based on Ollama OpenAPI specification using NSwag.

### Usage
```csharp
using Ollama;

using var client = new HttpClient();
var api = new OllamaApi(apiKey, client);
var response = await api.CompleteAsync(new CreateCompletionRequest
{
Model = ModelIds.ClaudeInstant,
Prompt = "Once upon a time".AsPrompt(),
Max_tokens_to_sample = 250,
});
Console.WriteLine(response.Completion);

// or use history syntax
var response = await api.CompleteAsync(new CreateCompletionRequest
{
Model = ModelIds.ClaudeInstant,
Prompt = new[]
{
"What's the weather like today?".AsHumanMessage(),
"Sure! Could you please provide me with your location?".AsAssistantMessage(),
"Dubai, UAE".AsHumanMessage(),
}.AsPrompt(),
Max_tokens_to_sample = 300,
});
```

## Support

Priority place for bugs: https://github.com/tryAGI/Ollama/issues
Priority place for ideas and general questions: https://github.com/tryAGI/Ollama/discussions
Discord: https://discord.gg/Ca2xhfBf3v
Binary file added assets/nuget_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 0d9e76f

Please sign in to comment.