diff --git a/README.md b/README.md index 7d7cfe9..4549073 100644 --- a/README.md +++ b/README.md @@ -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] 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 - [ ] Add more providers - [ ] 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 diff --git a/app/utils/providers/instructions.md b/app/utils/providers/instructions.md new file mode 100644 index 0000000..ce25fe1 --- /dev/null +++ b/app/utils/providers/instructions.md @@ -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. \ No newline at end of file diff --git a/app/utils/providers/skeleton_provider.py b/app/utils/providers/skeleton_provider.py new file mode 100644 index 0000000..0ed0636 --- /dev/null +++ b/app/utils/providers/skeleton_provider.py @@ -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 \ No newline at end of file