GroqSharp 1.1.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package GroqSharp --version 1.1.1                
NuGet\Install-Package GroqSharp -Version 1.1.1                
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="GroqSharp" Version="1.1.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add GroqSharp --version 1.1.1                
#r "nuget: GroqSharp, 1.1.1"                
#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.
// Install GroqSharp as a Cake Addin
#addin nuget:?package=GroqSharp&version=1.1.1

// Install GroqSharp as a Cake Tool
#tool nuget:?package=GroqSharp&version=1.1.1                

GroqSharp

NuGet Badge Build and Test Publish to NuGet

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:

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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • 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.

Version Downloads Last updated
1.1.2 2,222 5/7/2024
1.1.1 99 5/7/2024
1.1.0 134 5/6/2024
1.0.3 115 5/6/2024
1.0.2 111 4/29/2024
1.0.1 107 4/29/2024
1.0.0 113 4/29/2024

- Add POCO mapping for structured responses