added developers instructions

This commit is contained in:
tcsenpai 2024-09-18 11:47:59 +02:00
parent 1b8387c043
commit 43f0f1695d
3 changed files with 44 additions and 1 deletions

View File

@ -14,11 +14,16 @@ This is an early prototype of using prompting strategies to improve the LLM's re
- [x] Perplexity (remote, requires API key) - [x] Perplexity (remote, requires API key)
- [x] Groq (remote, requires API key) - [x] Groq (remote, requires API key)
## Developer Resources
- Instructions for adding new providers can be found in `app/utils/providers/instructions.md`
- A skeleton provider template is available at `app/utils/providers/skeleton_provider.py`
## Work in progress ## Work in progress
- [ ] Add more providers - [ ] Add more providers
- [ ] Possibly use LiteLLM instead of defining each provider - [ ] Possibly use LiteLLM instead of defining each provider
- [ ] Create a guide to quickly add providers - [ ] Create a better way to add new providers for developers
## Example ## Example

View File

@ -0,0 +1,21 @@
# Creating a New Provider
To add a new provider to the multi1 application, follow these steps:
1. Create a new file in the `app/handlers/` directory named `your_provider_handler.py`.
2. Copy the contents of the `skeleton_provider.py` file into your new handler file.
3. Rename the class to match your provider (e.g., `YourProviderHandler`).
4. Implement the `__init__`, `_make_request`, and `_process_response` methods according to your provider's API requirements.
5. Import your new handler in `app/handlers/__init__.py`.
6. Update the `get_api_handler` function in `app/main.py` to include your new provider.
7. Add the necessary configuration options in `app/config_menu.py`.
8. Update the `README.md` file to include information about the new provider.
Remember to handle API keys, rate limiting, and error responses appropriately for your provider.

View File

@ -0,0 +1,17 @@
from api_handlers import BaseHandler
class SkeletonProviderHandler(BaseHandler):
def __init__(self, api_key, model):
super().__init__()
self.api_key = api_key
self.model = model
def _make_request(self, messages, max_tokens):
# Implement the API request to your provider here
# Return the raw response from the API
pass
def _process_response(self, response, is_final_answer):
# Process the API response and return a formatted dictionary
# The dictionary should have 'title', 'content', and 'next_action' keys
pass