Skip to content

Commit

Permalink
feat: Added template.
Browse files Browse the repository at this point in the history
  • Loading branch information
HavenDV committed Jul 31, 2023
1 parent c487fdb commit a53a46f
Show file tree
Hide file tree
Showing 20 changed files with 761 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
patreon: havendv
ko_fi: havendv
custom: [
"https://www.paypal.me/havendv",
"https://www.buymeacoffee.com/havendv",
"https://www.upwork.com/freelancers/~017b1ad6f6af9cc189"]
41 changes: 41 additions & 0 deletions .github/ISSUE_TEMPLATE/bug-report.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Bug report
description: File a bug report
title: "Bug title"
labels: [bug]
body:
- type: textarea
validations:
required: true
attributes:
label: Describe the bug
description: Please enter a short, clear description of the bug.

- type: textarea
validations:
required: true
attributes:
label: Steps to reproduce the bug
description: Please provide any required setup and steps to reproduce the behavior.
placeholder: |
1. Go to '...'
2. Click on '....'
- type: textarea
attributes:
label: Expected behavior
description: Please provide a description of what you expected to happen

- type: textarea
attributes:
label: Screenshots
description: If applicable, add screenshots here to help explain your problem

- type: textarea
attributes:
label: NuGet package version
description: Specify the version you're using.

- type: textarea
attributes:
label: Additional context
description: Enter any other applicable info here
13 changes: 13 additions & 0 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Build, test and publish
on: [ push ]

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
additional-test-arguments: '--logger GitHubActions'
secrets:
nuget-key: ${{ secrets.NUGET_KEY }}
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 Cohere.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.nswag = docs\openapi.nswag
docs\openapi.yaml = docs\openapi.yaml
README.md = README.md
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}") = "Cohere", "src\libs\Cohere\Cohere.csproj", "{0028BC85-0064-4CE8-A21A-C1F5E922BD59}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cohere.IntegrationTests", "src\tests\Cohere.IntegrationTests\Cohere.IntegrationTests.csproj", "{592ADBC9-C951-4AF7-A163-B6C63B970B19}"
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
{592ADBC9-C951-4AF7-A163-B6C63B970B19}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{592ADBC9-C951-4AF7-A163-B6C63B970B19}.Debug|Any CPU.Build.0 = Debug|Any CPU
{592ADBC9-C951-4AF7-A163-B6C63B970B19}.Release|Any CPU.ActiveCfg = Release|Any CPU
{592ADBC9-C951-4AF7-A163-B6C63B970B19}.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}
{592ADBC9-C951-4AF7-A163-B6C63B970B19} = {AAA11B78-2764-4520-A97E-46AA7089A588}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {CED9A020-DBA5-4BE6-8096-75E528648EC1}
EndGlobalSection
EndGlobal
39 changes: 38 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,39 @@
# Cohere
Generated C# SDK based on official Cohere OpenAPI specification

[![Nuget package](https://img.shields.io/nuget/vpre/Cohere)](https://www.nuget.org/packages/Cohere/)
[![dotnet](https://github.com/tryAGI/Cohere/actions/workflows/dotnet.yml/badge.svg?branch=main)](https://github.com/tryAGI/Cohere/actions/workflows/dotnet.yml)
[![License: MIT](https://img.shields.io/github/license/tryAGI/Cohere)](https://github.com/tryAGI/Cohere/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 Cohere OpenAPI specification using NSwag.
Includes [tokenizer](https://github.com/tryAGI/Tiktoken) and some helper methods.

### Usage
```csharp
using Cohere;

using var client = new HttpClient();
var api = new CohereApi(apiKey, client);
var response = await api.GenerateTextAsync(
RecommendedModelIds.Gpt2,
new GenerateTextRequest
{
Inputs = "Hello",
Parameters = new GenerateTextRequestParameters
{
Max_new_tokens = 250,
Return_full_text = false,
},
Options = new GenerateTextRequestOptions
{
Use_cache = true,
Wait_for_model = false,
},
});
```

## Support

Priority place for bugs: https://github.com/tryAGI/Cohere/issues
Priority place for ideas and general questions: https://github.com/tryAGI/Cohere/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.
100 changes: 100 additions & 0 deletions docs/openapi.nswag
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
{
"runtime": "Default",
"defaultVariables": null,
"documentGenerator": {
"fromDocument": {
"json": "",
"url": "openapi.yaml",
"output": null,
"newLineBehavior": "Auto"
}
},
"codeGenerators": {
"openApiToCSharpClient": {
"clientBaseClass": null,
"configurationClass": null,
"generateClientClasses": true,
"generateClientInterfaces": false,
"clientBaseInterface": null,
"injectHttpClient": true,
"disposeHttpClient": true,
"protectedMethods": [],
"generateExceptionClasses": true,
"exceptionClass": "ApiException",
"wrapDtoExceptions": true,
"useHttpClientCreationMethod": false,
"httpClientType": "System.Net.Http.HttpClient",
"useHttpRequestMessageCreationMethod": false,
"useBaseUrl": true,
"generateBaseUrlProperty": true,
"generateSyncMethods": false,
"generatePrepareRequestAndProcessResponseAsAsyncMethods": true,
"exposeJsonSerializerSettings": false,
"clientClassAccessModifier": "public",
"typeAccessModifier": "public",
"generateContractsOutput": false,
"contractsNamespace": null,
"contractsOutputFilePath": null,
"parameterDateTimeFormat": "s",
"parameterDateFormat": "yyyy-MM-dd",
"generateUpdateJsonSerializerSettingsMethod": true,
"useRequestAndResponseSerializationSettings": false,
"serializeTypeInformation": false,
"queryNullValue": "",
"className": "{controller}CohereApi",
"operationGenerationMode": "MultipleClientsFromOperationId",
"additionalNamespaceUsages": [],
"additionalContractNamespaceUsages": [],
"generateOptionalParameters": true,
"generateJsonMethods": false,
"enforceFlagEnums": false,
"parameterArrayType": "System.Collections.Generic.IEnumerable",
"parameterDictionaryType": "System.Collections.Generic.IDictionary",
"responseArrayType": "System.Collections.Generic.ICollection",
"responseDictionaryType": "System.Collections.Generic.IDictionary",
"wrapResponses": false,
"wrapResponseMethods": [],
"generateResponseClasses": true,
"responseClass": "SwaggerResponse",
"namespace": "Cohere",
"requiredPropertiesMustBeDefined": true,
"dateType": "System.DateTimeOffset",
"jsonConverters": null,
"anyType": "object",
"dateTimeType": "System.DateTimeOffset",
"timeType": "System.TimeSpan",
"timeSpanType": "System.TimeSpan",
"arrayType": "System.Collections.Generic.ICollection",
"arrayInstanceType": "System.Collections.ObjectModel.Collection",
"dictionaryType": "System.Collections.Generic.IDictionary",
"dictionaryInstanceType": "System.Collections.Generic.Dictionary",
"arrayBaseType": "System.Collections.ObjectModel.Collection",
"dictionaryBaseType": "System.Collections.Generic.Dictionary",
"classStyle": "Poco",
"jsonLibrary": "SystemTextJson",
"generateDefaultValues": true,
"generateDataAnnotations": true,
"excludedTypeNames": [],
"excludedParameterNames": [],
"handleReferences": false,
"generateImmutableArrayProperties": false,
"generateImmutableDictionaryProperties": false,
"jsonSerializerSettingsTransformationMethod": null,
"inlineNamedArrays": false,
"inlineNamedDictionaries": false,
"inlineNamedTuples": true,
"inlineNamedAny": false,
"generateDtoTypes": true,
"generateOptionalPropertiesAsNullable": true,
"generateNullableReferenceTypes": true,
"templateDirectory": null,
"typeNameGeneratorType": null,
"propertyNameGeneratorType": null,
"enumNameGeneratorType": null,
"serviceHost": null,
"serviceSchemes": null,
"output": null,
"newLineBehavior": "Auto"
}
}
}
Loading

0 comments on commit a53a46f

Please sign in to comment.