Skip to content

Prebuilt AI Agents that work out of the box. Solely supports Groq

Notifications You must be signed in to change notification settings

KnextKoder/groq_agents

Repository files navigation

Groq Agents

Prebuilt task-specific AI agents running exclusively on Groq hardware. This project is currently under development.

Table of Contents

Installation

To install the necessary dependencies, run:

npm install

Usage

To build the project, execute:

npm run build

Then, you can utilize the GroqAgent class as follows:

import GroqAgent from './dist/index';

async function demo() {
    const client = new GroqAgent('your_api_key', 'llama3-70b-8192');
    console.log(await client.models()); // Logs all available models
    console.log(await client.agents()); // Logs all available agents
    const agent = client.create('Write a poem', 'You are a poet');
    console.log(agent.messages[agent.messages.length - 1].content); // Logs the last message content
}

demo();

Replace 'your_api_key' with your actual Groq API key. You can obtain an API key by signing up at Groq Console.

API Reference

GroqAgent Class

The GroqAgent class provides methods to interact with Groq's AI models and agents.

Methods

agents()

Retrieves a list of available agents.

Returns:

  • Promise<Array>: An array of agent names.

Example:

const availableAgents = await client.agents();
console.log(availableAgents);
selectAgent(agentName)

Selects a specific agent by name.

Parameters:

  • agentName (string): The name of the agent to select.

Returns:

  • Object: The selected agent object.

Example:

const agent = client.selectAgent('agent_name');
console.log(agent);
call(input)

Sends input to the selected agent and retrieves the response.

Parameters:

  • input (string): The input text to send to the agent.

Returns:

  • Promise<string>: The agent's response.

Example:

const response = await agent.call('Your input text');
console.log(response);
models()

Fetches a list of available models.

Returns:

  • Promise<Array>: An array of model names.

Example:

const availableModels = await client.models();
console.log(availableModels);
create(prompt, systemMessage)

Creates a new agent with a specific prompt and system message.

Parameters:

  • prompt (string): The initial prompt for the agent.
  • systemMessage (string): The system message defining the agent's behavior.

Returns:

  • Object: The created agent object.

Example:

const agent = client.create('Write a poem', 'You are a poet');
console.log(agent);

Contributing

We welcome contributions to enhance this project. To contribute:

  1. Fork the repository.
  2. Create a new branch: git checkout -b feature/YourFeature.
  3. Commit your changes: git commit -m 'Add YourFeature'.
  4. Push to the branch: git push origin feature/YourFeature.
  5. Open a pull request.

Please ensure your code adheres to the project's coding standards and includes appropriate tests.

License

This project is licensed under the MIT License. See the LICENSE file for details.

About

Prebuilt AI Agents that work out of the box. Solely supports Groq

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published