GroqSharp 1.1.0
See the version list below for details.
dotnet add package GroqSharp --version 1.1.0
NuGet\Install-Package GroqSharp -Version 1.1.0
<PackageReference Include="GroqSharp" Version="1.1.0" />
paket add GroqSharp --version 1.1.0
#r "nuget: GroqSharp, 1.1.0"
// Install GroqSharp as a Cake Addin #addin nuget:?package=GroqSharp&version=1.1.0 // Install GroqSharp as a Cake Tool #tool nuget:?package=GroqSharp&version=1.1.0
GroqSharp
GroqSharp is a community maintained C# client library for interacting with GroqCloud. Designed to provide a simple and flexible interface, it enables seamless integration of Groq services into your C# applications.
Why GroqSharp?
GroqSharp is designed to simplify your interactions with GroqCloud by offering:
- Fluent API: Configure client options and parameters fluently for convenient setup.
- Structured Responses: Utilize specific JSON response structures for predictable outputs.
- Function Integration: Integrate and manage function calling within your applications.
- Retry Mechanism: Implement configurable retry policies to handle transient errors when working with structured data effectively.
- Streaming Support: Support for streaming responses to process data as it becomes available, providing real-time interaction capabilities.
GroqSharp's function/tool integration support allows developers to extend the functionality of the Groq platform within their applications, making it easier to implement complex workflows and data manipulations directly within chat interfaces.
Getting Started
Installation
Install GroqSharp via NuGet:
dotnet add package GroqSharp
Environment Setup
For security and flexibility, it is recommended to store your API key in an environment variable. This prevents hardcoding sensitive information in your source code:
var apiKey = Environment.GetEnvironmentVariable("GROQ_API_KEY");
var apiModel = "llama3-70b-8192"; // Or other supported model
var groqClient = new GroqClient(apiKey, apiModel);
Fluent Configuration
Configure your client using a fluent API:
IGroqClient groqClient = new GroqClient(apiKey, apiModel)
.SetTemperature(0.5)
.SetMaxTokens(512)
.SetTopP(1)
.SetStop("NONE")
.SetStructuredRetryPolicy(5); // Retry up to 5 times on failure
Examples
Explore sample projects that demonstrate various capabilities of GroqSharp:
- Chat Basics - Basic chat functionalities.
- Chat Streaming - Streaming responses for dynamic interaction.
- Structured Data - Handling structured JSON responses.
- Tool Integration - Using custom tools for enhanced functionalities.
Contributing
Contributions are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request.
License
This library is licensed under the MIT License. See the LICENSE file for more details.
Conclusion
GroqSharp offers a flexible and efficient way to incorporate Groq's capabilities into your C# projects, ensuring secure and configurable interaction management.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | 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. |
-
net8.0
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on GroqSharp:
Package | Downloads |
---|---|
LangChain.Providers.Groq
Groq model provider. |
GitHub repositories
This package is not used by any popular GitHub repositories.
- Added dedicated Sample Projects
- Added support for Function / Tool Calling