Skip to content

RGGH/actix-rigrs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

actix rig Rust

This project leverages Rig and Actix-web for building a fast, asynchronous web server with Rig, that helps you "build modular and scalable LLM Applications in Rust".
OpenAI has been used here (so you will need to set the API key in your env). Rig allows you to easily switch LLM providers.

Tech Stack

https://actix.rs/
https://rig.rs/

  • Rig: Rig is a Rust library for building portable, modular, and lightweight Fullstack AI Agents. You can find API documentation on docs.rs.
  • Actix-web: A fast and powerful web framework for Rust, designed for asynchronous operations.
  • Rig Tools: Tools are a core concept in Rig that allow agents to perform specific actions or computations. They provide a structured way to extend an agent’s capabilities beyond pure language model interactions.

🌟 tip

Avoid using #[tokio::main] in "run", as Actix already provides an async context. Instead, just make run a regular async function without creating a new (tokio) runtime.
("run" is the name that I used in rig.rs for the function that calls the LLM).
You can't start a Tokio runtime from within another Tokio runtime - so if you ever build everything in main.rs to begin with and then refactor yoru code, make sure your "new" main.rs with the actix-web entry point, is calling the function from another file which does NOT have #[tokio::main] above it!

Getting Started

Installation

  1. Clone the repository:

    git clone https://github.com/RGGH/actix_rig
    cd actix_rig
  2. Install dependencies:

    cargo build
  3. Create a .env file and add your OpenAI API key:

    OPENAI_API_KEY=your_openai_api_key
  4. Run the project:

    cargo run
  5. Run Python test.py:

    cd tests/
    python3 test.py

Image description Image description Image description

Features

  • Efficient, async HTTP handling with Actix-web.

  • Use LLM's with Rust and tools written in Rust.

  • Scalable and easily extensible API structure.

    Tasks

  • Create endpoint for query

    • Implement a basic endpoint to handle query requests.
  • Pass query/queries as input parameter(s)

    • Modify the endpoint to accept query as an input parameter.
  • Start a Docker Container as an Agent

    • Bring your own Docker image
  • Build MVP front end

    • Create a minimal front end to interact with the endpoint(s).

License

This project is licensed under the MIT License.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published