Advanced Chain of Thought (CoT) Reasoning API with Reinforcement Learning (RL)

Fragaria is a powerful and flexible Chain of Thought (CoT) reasoning API that leverages various Language Model (LLM) providers and incorporates Reinforcement Learning (RL) techniques to solve complex problems and answer intricate questions. Named after the botanical genus of strawberries, Fragaria pays homage to the famous "How many 'r's in strawberry?" problem, symbolizing its ability to tackle both simple and complex queries with equal finesse.
Clone the repository:
git clone https://github.com/terraprompt/fragaria.git
cd fragaria
Create a virtual environment (optional but recommended):
python -m venv venv
source venv/bin/activate # On Windows, use `venvScriptsactivate`
Install the required dependencies:
pip install -r requirements.txt
Copy the config.yaml.example file to config.yaml:
cp config.yaml.example config.yaml
Open config.yaml and update the following settings:
llm_provider (openai, groq, or together)Start the Fragaria API server:
python main.py
The API will be available at http://localhost:8000 (or the host/port specified in your config).
You can now send POST requests to http://localhost:8000/v1/chat/completions to use the Chain of Thought reasoning capabilities.
Fragaria provides comprehensive API documentation:
http://localhost:8000/docs
http://localhost:8000/redoc
http://localhost:8000/openapi.json
Here are some sample problems you can solve using Fragaria:
The classic strawberry problem:
{
"model": "faragia-dev",
"messages": [
{"role": "user", "content": "How many 'r's in strawberry?"}
]
}A more complex age-related puzzle:
{
"model": "faragia-dev",
"messages": [
{"role": "user", "content": "A princess is as old as the prince will be when the princess is twice as old as the prince was when the princess's age was half the sum of their present age. What is the age of prince and princess? Provide all solutions to that question."}
]
}To solve these problems, send a POST request to /v1/chat/completions with the above JSON payloads.
Fragaria employs a sophisticated Chain of Thought (CoT) reasoning process enhanced by Reinforcement Learning:
This RL-enhanced process allows Fragaria to not only tackle a wide range of problems but also to learn and adapt its strategies over time, becoming increasingly efficient at solving both familiar and novel problem types.
We welcome contributions to Fragaria! Please follow these steps to contribute:
Please ensure your code adheres to the project's coding standards and include tests for new features.
Fragaria is released under the MIT License. See the LICENSE file for details.
If you use Fragaria in your research or wish to refer to it in your publications, please use the following BibTeX entry:
@software{fragaria2024,
author = {{Dipankar Sarkar}},
title = {Fragaria: Advanced Chain of Thought Reasoning API with Reinforcement Learning},
year = 2024,
publisher = {GitHub},
journal = {GitHub repository},
howpublished = {url{https://github.com/terraprompt/fragaria}},
}For academic papers, you can cite Fragaria as:
Dipankar Sarkar. (2024). Fragaria: Advanced Chain of Thought Reasoning API with Reinforcement Learning [Computer software]. https://github.com/terraprompt/fragaria
Fragaria is maintained by the TerraPrompt team. For any questions or support, please open an issue on the GitHub repository.