Skip to content
This repository has been archived by the owner on Sep 7, 2024. It is now read-only.
/ GroqAPI-cpp Public archive

GroqAPI-cpp (Groq API Wrapper) is a minimalistic C++ library for easy interaction with the Groq API. It simplifies sending requests, processing responses, and supports multithreading. Ideal for integrating Groq's language processing into C++ applications efficiently. Works seamlessly with C++14 and later versions.

Notifications You must be signed in to change notification settings

90th/GroqAPI-cpp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GroqAPI Logo

GitHub Downloads (all assets, latest release) GitHub last commit GitHub Repo stars

GroqAPI-cpp (Groq API Wrapper) is a minimalistic C++ library for easy interaction with the Groq API. It simplifies sending requests, processing responses, and supports multithreading. Ideal for integrating Groq's language processing into C++ applications efficiently. Works seamlessly with C++14 and later versions.

Features

  • Send chat requests to the Groq API with ease.
  • Print chat responses directly to the console.
  • Thread-safe singleton pattern ensures safe concurrent access.
  • Utilizes Windows HTTP Services for network communication.
  • Supports C++14 and later versions.

Usage

#include "GroqAPI.hpp"

int main() {
	try {
		std::string apiKey = "groq-api-key";
		std::string model = "llama3-8b-8192";
		std::string userMessage = "Hello there!";

		std::string response = Groq::GroqApi::GetInstance().SendChatRequest(apiKey, model, userMessage);
		Groq::GroqApi::GetInstance().PrintChatResponse(response);
	}
	catch (const std::exception& e) {
		std::cerr << "Error: " << e.what() << std::endl;
	}
	return 0;
}

Dependencies

  • Windows SDK (for WinHttp)
  • nlohmann/json (included as a header-only library)
  • C++14 compiler or later

Installation

Simply include the GroqApi.hpp header file in your project and link against the Windows HTTP Services library (winhttp.lib).

About

GroqAPI-cpp (Groq API Wrapper) is a minimalistic C++ library for easy interaction with the Groq API. It simplifies sending requests, processing responses, and supports multithreading. Ideal for integrating Groq's language processing into C++ applications efficiently. Works seamlessly with C++14 and later versions.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages