This repository provides a modular framework for interacting with multiple language model APIs (OpenAI, Anthropic, and Mistral). It enables text generation, embedding retrieval, semantic search, and multi-step prompt flows, allowing users to leverage various models in a structured workflow.
- LLM_FLOW_1.ipynb: Introduces the modular framework, including setup for different language model APIs and initial examples of text generation and embedding retrieval.
- LLM_FLOW_2.ipynb: Expands on the framework to include multi-step prompt flows and complex workflows, demonstrating semantic search, text processing, and advanced interactions.
The notebooks implement a flexible and dynamic workflow for:
- Text Generation: Generate responses and creative content with various LLMs.
- Embedding Retrieval: Retrieve embeddings for documents and perform similarity searches.
- Semantic Search: Use embeddings and cosine similarity to find relevant information.
- Multi-Step Prompt Flows: Design custom workflows that chain multiple prompts and processes together.
This setup enables efficient text generation and data processing with multiple models in a single, cohesive workflow.
To run these notebooks, you will need:
- Python 3.8+
- Jupyter Notebook
- API keys for each language model service (OpenAI, Anthropic, Mistral)
- Required dependencies as listed in
requirements.txt
-
Clone the repository:
git clone https://github.com/simonpierreboucher/llm_flow_notebook.git cd llm_flow_notebook -
Install the dependencies:
pip install -r requirements.txt
- Start Jupyter Notebook: Open Jupyter by navigating to the repository folder and running:
jupyter notebook
- Select a Notebook: Open either
LLM_FLOW_1.ipynborLLM_FLOW_2.ipynbto explore the modular framework and interact with the LLM APIs. - Follow Instructions: Each notebook includes code and setup instructions for different API interactions and use cases.
- Modular Text Generation: Use different LLMs interchangeably for text creation tasks.
- Cross-Model Embedding and Semantic Search: Retrieve embeddings from various models and apply semantic search techniques.
- Custom Prompt Workflows: Design and implement complex multi-step workflows that chain prompts across different models and APIs.
We welcome contributions! Feel free to submit issues or pull requests to add features, fix bugs, or improve the framework.
This repository is licensed under the MIT License.