Skip to content

armgit / dspy

Public Imported from GitHub
0

DSPy: The framework for programming—not prompting—language models

Python

Port API References to Deep Dive

Herumb Shandilya5b82ef0c11d2
diff --git a/docs/api/functional/_category_.json b/docs/api/functional/_category_.json
deleted file mode 100644
index 70bd70104..000000000
--- a/docs/api/functional/_category_.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "label": "Functional",
- "position": 2,
- "link": {
- "type": "generated-index",
- "description": "This documentation provides an overview of the Typed Predictors."
- }
-}
\ No newline at end of file
diff --git a/docs/api/functional/dspy_TypedCoT.md b/docs/api/functional/dspy_TypedCoT.md
deleted file mode 100644
index e728bdad0..000000000
--- a/docs/api/functional/dspy_TypedCoT.md
+++ /dev/null
@@ -1,41 +0,0 @@
----
-sidebar_position: 2
----
-
-# dspy.TypedChainOfThought
-
-### Overview
-
-#### `def TypedChainOfThought(signature, max_retries=3) -> dspy.Module`
-
-Adds a Chain of Thoughts `dspy.OutputField` to the `dspy.TypedPredictor` module by prepending it to the Signature. Similar to `dspy.TypedPredictor` but automatically adds a "reasoning" output field.
-
-* **Inputs**:
- * `signature`: The `dspy.Signature` specifying the input/output fields
- * `max_retries`: Maximum number of retries if outputs fail validation
-* **Output**: A dspy.Module instance capable of making predictions.
-
-### Example
-
-```python
-from dspy import InputField, OutputField, Signature
-from dspy.functional import TypedChainOfThought
-from pydantic import BaseModel
-
-# We define a pydantic type that automatically checks if it's argument is valid python code.
-class CodeOutput(BaseModel):
- code: str
- api_reference: str
-
-class CodeSignature(Signature):
- function_description: str = InputField()
- solution: CodeOutput = OutputField()
-
-cot_predictor = TypedChainOfThought(CodeSignature)
-prediction = cot_predictor(
- function_description="Write a function that adds two numbers."
-)
-
-print(prediction["code"])
-print(prediction["api_reference"])
-```
\ No newline at end of file
diff --git a/docs/api/functional/dspy_TypedPredictor.md b/docs/api/functional/dspy_TypedPredictor.md
deleted file mode 100644
index 8e5fd5857..000000000
--- a/docs/api/functional/dspy_TypedPredictor.md
+++ /dev/null
@@ -1,78 +0,0 @@
----
-sidebar_position: 1
----
-
-# dspy.TypedPredictor
-
-The `TypedPredictor` class is a sophisticated module designed for making predictions with strict type validations. It leverages a signature to enforce type constraints on inputs and outputs, ensuring that the data follows to the expected schema.
-
-### Constructor
-
-```python
-TypedPredictor(
- CodeSignature
- max_retries=3
-)
-```
-
-Parameters:
-* `signature` (dspy.Signature): The signature that defines the input and output fields along with their types.
-* `max_retries` (int, optional): The maximum number of retries for generating a valid prediction output. Defaults to 3.
-
-### Methods
-
-#### `copy() -> "TypedPredictor"`
-
-Creates and returns a deep copy of the current TypedPredictor instance.
-
-**Returns:** A new instance of TypedPredictor that is a deep copy of the original instance.
-
-#### `_make_example(type_: Type) -> str`
-
-A static method that generates a JSON object example based pn the schema of the specified Pydantic model type. This JSON object serves as an example for the expected input or output format.
-
-**Parameters:**
-* `type_`: A Pydantic model class for which an example JSON object is to be generated.
-
-**Returns:** A string that represents a JSON object example, which validates against the provided Pydantic model's JSON schema. If the method is unable to generate a valid example, it returns an empty string.
-
-#### `_prepare_signature() -> dspy.Signature`
-
-Prepares and returns a modified version of the signature associated with the TypedPredictor instance. This method iterates over the signature's fields to add format and parser functions based on their type annotations.
-
-**Returns:** A dspy.Signature object that has been enhanced with formatting and parsing specifications for its fields.
-
-#### `forward(**kwargs) -> dspy.Prediction`
-
-Executes the prediction logic, making use of the `dspy.Predict` component to generate predictions based on the input arguments. This method handles type validation, parsing of output data, and implements retry logic in case the output does not initially follow to the specified output schema.
-
-**Parameters:**
-
-* `**kwargs`: Keyword arguments corresponding to the input fields defined in the signature.
-
-**Returns:** A dspy.Prediction object containing the prediction results. Each key in this object corresponds to an output field defined in the signature, and its value is the parsed result of the prediction.
-
-### Example
-
-```python
-from dspy import InputField, OutputField, Signature
-from dspy.functional import TypedPredictor
-from pydantic import BaseModel
-
-# We define a pydantic type that automatically checks if it's argument is valid python code.
-class CodeOutput(BaseModel):
- code: str
- api_reference: str
-
-class CodeSignature(Signature):
- function_description: str = InputField()
- solution: CodeOutput = OutputField()
-
-cot_predictor = TypedPredictor(CodeSignature)
-prediction = cot_predictor(
- function_description="Write a function that adds two numbers."
-)
-
-print(prediction["code"])
-print(prediction["api_reference"])
-```
\ No newline at end of file
diff --git a/docs/api/functional/dspy_cot.md b/docs/api/functional/dspy_cot.md
deleted file mode 100644
index 35a98ce2f..000000000
--- a/docs/api/functional/dspy_cot.md
+++ /dev/null
@@ -1,30 +0,0 @@
----
-sidebar_position: 4
----
-
-# dspy.cot
-
-### Overview
-
-#### `def cot(func) -> dspy.Module`
-
-The `@cot` decorator is used to create a Chain of Thoughts module based on the provided function. It automatically generates a `dspy.TypedPredictor` from the function's type annotations and docstring. Similar to predictor, but adds a "Reasoning" output field to capture the model's step-by-step thinking.
-
-* **Input**: Function with input parameters and return type annotation.
-* **Output**: A dspy.Module instance capable of making predictions.
-
-### Example
-
-```python
-import dspy
-
-context = ["Roses are red.", "Violets are blue"]
-question = "What color are roses?"
-
-def generate_answer(self, context: list[str], question) -> str:
- """Answer questions with short factoid answers."""
- pass
-
-generate_answer(context=context, question=question)
-```
diff --git a/docs/api/functional/dspy_predictor.md b/docs/api/functional/dspy_predictor.md
deleted file mode 100644
index 9d4814c0f..000000000
--- a/docs/api/functional/dspy_predictor.md
+++ /dev/null
@@ -1,30 +0,0 @@
----
-sidebar_position: 3
----
-
-# dspy.predictor
-
-### Overview
-
-#### `def predictor(func) -> dspy.Module`
-
-The `@predictor` decorator is used to create a predictor module based on the provided function. It automatically generates a `dspy.TypedPredictor` and from the function's type annotations and docstring.
-
-* **Input**: Function with input parameters and return type annotation.
-* **Output**: A dspy.Module instance capable of making predictions.
-
-### Example
-
-```python
-import dspy
-
-context = ["Roses are red.", "Violets are blue"]
-question = "What color are roses?"
-
-def generate_answer(self, context: list[str], question) -> str:
- """Answer questions with short factoid answers."""
- pass
-
-generate_answer(context=context, question=question)
-```
\ No newline at end of file
diff --git a/docs/api/intro.md b/docs/api/intro.md
deleted file mode 100644
index 7859c7d0e..000000000
--- a/docs/api/intro.md
+++ /dev/null
@@ -1,7 +0,0 @@
----
-sidebar_position: 1
----
-
-# API References
-
-Welcome to the API References for DSPy! This is where you'll find easy-to-understand information about all the parts of DSPy that you can use in your projects. We've got guides on different tools and helpers that DSPy has, like modules and optimizers. Everything is sorted so you can quickly find what you need. If you're making something and need to quickly get started with DSPy to do certain tasks, this place will show you how to set it up and get it working just right.
\ No newline at end of file
diff --git a/docs/api/language_model_clients/Anyscale.md b/docs/api/language_model_clients/Anyscale.md
deleted file mode 100644
index c9485420e..000000000
--- a/docs/api/language_model_clients/Anyscale.md
+++ /dev/null
@@ -1,31 +0,0 @@
----
-sidebar_position: 6
----
-
-# dspy.Anyscale
-
-### Usage
-
-```python
-lm = dspy.Anyscale(model="mistralai/Mistral-7B-Instruct-v0.1")
-```
-
-### Constructor
-
-The constructor initializes the base class `LM` and verifies the `api_key` for using Anyscale API.
-We expect the following environment variables to be set:
-- `ANYSCALE_API_KEY`: API key for Together.
-- `ANYSCALE_API_BASE`: API base URL for Together.
-
-
-```python
-class Anyscale(HFModel):
- def __init__(self, model, **kwargs):
-```
-
-**Parameters:**
-- `model` (_str_): models hosted on Together.
-
-### Methods
-
-Refer to [`dspy.OpenAI`](https://dspy-docs.vercel.app/api/language_model_clients/OpenAI) documentation.
diff --git a/docs/api/language_model_clients/AzureOpenAI.md b/docs/api/language_model_clients/AzureOpenAI.md
deleted file mode 100644
index 9d8305fa3..000000000
--- a/docs/api/language_model_clients/AzureOpenAI.md
+++ /dev/null
@@ -1,60 +0,0 @@
----
-sidebar_position: 2
----
-
-# dspy.AzureOpenAI
-
-### Usage
-
-```python
-lm = dspy.AzureOpenAI(api_base='...', api_version='2023-12-01-preview', model='gpt-3.5-turbo')
-```
-
-### Constructor
-
-The constructor initializes the base class `LM` and verifies the provided arguments like the `api_provider`, `api_key`, and `api_base` to set up OpenAI request retrieval through Azure. The `kwargs` attribute is initialized with default values for relevant text generation parameters needed for communicating with the GPT API, such as `temperature`, `max_tokens`, `top_p`, `frequency_penalty`, `presence_penalty`, and `n`.
-
-Azure requires that the deployment id of the Azure deployment to be also provided using the argument `deployment_id`.
-
-```python
-class AzureOpenAI(LM):
- def __init__(
- self,
- api_base: str,
- api_version: str,
- model: str = "gpt-3.5-turbo-instruct",
- api_key: Optional[str] = None,
- model_type: Literal["chat", "text"] = None,
- **kwargs,
- ):
-```
-
-**Parameters:**
-
-- `api_base` (str): Azure Base URL.
-- `api_version` (str): Version identifier for Azure OpenAI API.
-- `api_key` (_Optional[str]_, _optional_): API provider authentication token. Retrieves from `AZURE_OPENAI_KEY` environment variable if None.
-- `model_type` (_Literal["chat", "text"]_): Specified model type to use, defaults to 'chat'.
-- `azure_ad_token_provider` (_Optional[AzureADTokenProvider]_, _optional_): Pass the bearer token provider created by _get_bearer_token_provider()_ when using DefaultAzureCredential, alternative to api token.
-- `**kwargs`: Additional language model arguments to pass to the API provider.
-
-### Methods
-
-#### `__call__(self, prompt: str, only_completed: bool = True, return_sorted: bool = False, **kwargs) -> List[Dict[str, Any]]`
-
-Retrieves completions from Azure OpenAI Endpoints by calling `request`.
-
-Internally, the method handles the specifics of preparing the request prompt and corresponding payload to obtain the response.
-
-After generation, the completions are post-processed based on the `model_type` parameter. If the parameter is set to 'chat', the generated content look like `choice["message"]["content"]`. Otherwise, the generated text will be `choice["text"]`.
-
-**Parameters:**
-
-- `prompt` (_str_): Prompt to send to Azure OpenAI.
-- `only_completed` (_bool_, _optional_): Flag to return only completed responses and ignore completion due to length. Defaults to True.
-- `return_sorted` (_bool_, _optional_): Flag to sort the completion choices using the returned averaged log-probabilities. Defaults to False.
-- `**kwargs`: Additional keyword arguments for completion request.
-
-**Returns:**
-
-- `List[Dict[str, Any]]`: List of completion choices.
diff --git a/docs/api/language_model_clients/Cloudflare.md b/docs/api/language_model_clients/Cloudflare.md
deleted file mode 100644
index 8c30bade1..000000000
--- a/docs/api/language_model_clients/Cloudflare.md
+++ /dev/null
@@ -1,42 +0,0 @@
----
-sidebar_position: 10
----
-
-# dspy.CloudflareAI
-
-### Usage
-
-```python
-lm = dspy.CloudflareAI(model="@hf/meta-llama/meta-llama-3-8b-instruct")
-```
-
-### Constructor
-
-The constructor initializes the base class `LM` and verifies the `api_key` and `account_id` for using Cloudflare AI API.
-The following environment variables are expected to be set or passed as arguments:
-
-- `CLOUDFLARE_ACCOUNT_ID`: Account ID for Cloudflare.
-- `CLOUDFLARE_API_KEY`: API key for Cloudflare.
-
-```python
-class CloudflareAI(LM):
- def __init__(
- self,
- model: str = "@hf/meta-llama/meta-llama-3-8b-instruct",
- account_id: Optional[str] = None,
- api_key: Optional[str] = None,
- system_prompt: Optional[str] = None,
- **kwargs,
- ):
-```
-
-**Parameters:**
-
-- `model` (_str_): Model hosted on Cloudflare. Defaults to `@hf/meta-llama/meta-llama-3-8b-instruct`.
-- `account_id` (_Optional[str]_, _optional_): Account ID for Cloudflare. Defaults to None. Reads from environment variable `CLOUDFLARE_ACCOUNT_ID`.
-- `api_key` (_Optional[str]_, _optional_): API key for Cloudflare. Defaults to None. Reads from environment variable `CLOUDFLARE_API_KEY`.
-- `system_prompt` (_Optional[str]_, _optional_): System prompt to use for generation.
-
-### Methods
-
-Refer to [`dspy.OpenAI`](https://dspy-docs.vercel.app/api/language_model_clients/OpenAI) documentation.
diff --git a/docs/api/language_model_clients/Cohere.md b/docs/api/language_model_clients/Cohere.md
deleted file mode 100644
index f9f874697..000000000
--- a/docs/api/language_model_clients/Cohere.md
+++ /dev/null
@@ -1,34 +0,0 @@
----
-sidebar_position: 3
----
-
-# dspy.Cohere
-
-### Usage
-
-```python
-lm = dspy.Cohere(model='command-nightly')
-```
-
-### Constructor
-
-The constructor initializes the base class `LM` and verifies the `api_key` to set up Cohere request retrieval.
-
-```python
-class Cohere(LM):
- def __init__(
- self,
- model: str = "command-nightly",
- api_key: Optional[str] = None,
- stop_sequences: List[str] = [],
- ):
-```
-
-**Parameters:**
-- `model` (_str_): Cohere pretrained models. Defaults to `command-nightly`.
-- `api_key` (_Optional[str]_, _optional_): API provider from Cohere. Defaults to None.
-- `stop_sequences` (_List[str]_, _optional_): List of stopping tokens to end generation.
-
-### Methods
-
-Refer to [`dspy.OpenAI`](https://dspy-docs.vercel.app/api/language_model_clients/OpenAI) documentation.
diff --git a/docs/api/language_model_clients/Databricks.md b/docs/api/language_model_clients/Databricks.md
deleted file mode 100644
index e6201e1dc..000000000
--- a/docs/api/language_model_clients/Databricks.md
+++ /dev/null
@@ -1,43 +0,0 @@
----
-sidebar_position: 8
----
-
-# dspy.Databricks
-
-### Usage
-```python
-lm = dspy.Databricks(model="databricks-mpt-30b-instruct")
-```
-
-### Constructor
-
-The constructor inherits from the `GPT3` class and verifies the Databricks authentication credentials for using Databricks Model Serving API through the OpenAI SDK.
-We expect the following environment variables to be set:
-- `openai.api_key`: Databricks API key.
-- `openai.base_url`: Databricks Model Endpoint url
-
-The `kwargs` attribute is initialized with default values for relevant text generation parameters needed for communicating with the Databricks OpenAI SDK, such as `temperature`, `max_tokens`, `top_p`, and `n`. However, it removes the `frequency_penalty` and `presence_penalty` arguments as these are not currently supported by the Databricks API.
-
-```python
-class Databricks(GPT3):
- def __init__(
- self,
- model: str,
- api_key: Optional[str] = None,
- api_base: Optional[str] = None,
- model_type: Literal["chat", "text"] = None,
- **kwargs,
- ):
-```
-
-**Parameters:**
-- `model` (_str_): models hosted on Databricks.
-- `stop` (_List[str]_, _optional_): List of stopping tokens to end generation.
-- `api_key` (_Optional[str]_): Databricks API key. Defaults to None
-- `api_base` (_Optional[str]_): Databricks Model Endpoint url Defaults to None.
-- `model_type` (_Literal["chat", "text", "embeddings"]_): Specified model type to use.
-- `**kwargs`: Additional language model arguments to pass to the API provider.
-
-### Methods
-
-Refer to [`dspy.OpenAI`](https://dspy-docs.vercel.app/api/language_model_clients/OpenAI) documentation.
\ No newline at end of file
diff --git a/docs/api/language_model_clients/Google_VertexAI.md b/docs/api/language_model_clients/Google_VertexAI.md
deleted file mode 100644
index bfd40a64c..000000000
--- a/docs/api/language_model_clients/Google_VertexAI.md
+++ /dev/null
@@ -1,56 +0,0 @@
----
-sidebar_position: 11
----
-
-# dspy.GoogleVertexAI
-
-This guide provides instructions on how to use the `GoogleVertexAI` class to interact with Google Vertex AI's API for text and code generation.
-
-## Requirements
-
-- Python 3.10 or higher.
-- The `vertexai` package installed, which can be installed via pip.
-- A Google Cloud account and a configured project with access to Vertex AI.
-
-## Installation
-
-Ensure you have installed the `vertexai` package along with other necessary dependencies:
-
-```bash
-pip install dspy-ai[google-vertex-ai]
-```
-
-## Configuration
-
-Before using the `GoogleVertexAI` class, you need to set up access to Google Cloud:
-
-1. Create a project in Google Cloud Platform (GCP).
-2. Enable the Vertex AI API for your project.
-3. Create authentication credentials and save them in a JSON file.
-
-## Usage
-
-Here's an example of how to instantiate the `GoogleVertexAI` class and send a text generation request:
-
-```python
-from dsp.modules import GoogleVertexAI # Import the GoogleVertexAI class
-
-# Initialize the class with the model name and parameters for Vertex AI
-vertex_ai = GoogleVertexAI(
- model_name="text-bison@002",
- project="your-google-cloud-project-id",
- location="us-central1",
- credentials="path-to-your-service-account-file.json"
-)
-```
-
-## Customizing Requests
-
-You can customize requests by passing additional parameters such as `temperature`, `max_output_tokens`, and others supported by the Vertex AI API. This allows you to control the behavior of the text generation.
-
-## Important Notes
-
-- Make sure you have correctly set up access to Google Cloud to avoid authentication issues.
-- Be aware of the quotas and limits of the Vertex AI API to prevent unexpected interruptions in service.
-
-With this guide, you're ready to use `GoogleVertexAI` for interacting with Google Vertex AI's text and code generation services.
diff --git a/docs/api/language_model_clients/Groq.md b/docs/api/language_model_clients/Groq.md
deleted file mode 100644
index 8f5eae1a4..000000000
--- a/docs/api/language_model_clients/Groq.md
+++ /dev/null
@@ -1,51 +0,0 @@
----
-sidebar_position: 9
----
-
-# dspy.GROQ
-
-### Usage
-
-```python
-lm = dspy.GROQ(model='mixtral-8x7b-32768', api_key ="gsk_***" )
-```
-
-### Constructor
-
-The constructor initializes the base class `LM` and verifies the provided arguments like the `api_key` for GROQ api retriver. The `kwargs` attribute is initialized with default values for relevant text generation parameters needed for communicating with the GROQ API, such as `temperature`, `max_tokens`, `top_p`, `frequency_penalty`, `presence_penalty`, and `n`.
-
-```python
-class GroqLM(LM):
- def __init__(
- self,
- api_key: str,
- model: str = "mixtral-8x7b-32768",
- **kwargs,
- ):
-```
-
-
-
-**Parameters:**
-- `api_key` str: API provider authentication token. Defaults to None.
-- `model` str: model name. Defaults to "mixtral-8x7b-32768' options: ['llama2-70b-4096', 'gemma-7b-it']
-- `**kwargs`: Additional language model arguments to pass to the API provider.
-
-### Methods
-
-#### `def __call__(self, prompt: str, only_completed: bool = True, return_sorted: bool = False, **kwargs, ) -> list[dict[str, Any]]:`
-
-Retrieves completions from GROQ by calling `request`.
-
-Internally, the method handles the specifics of preparing the request prompt and corresponding payload to obtain the response.
-
-After generation, the generated content look like `choice["message"]["content"]`.
-
-**Parameters:**
-- `prompt` (_str_): Prompt to send to GROQ.
-- `only_completed` (_bool_, _optional_): Flag to return only completed responses and ignore completion due to length. Defaults to True.
-- `return_sorted` (_bool_, _optional_): Flag to sort the completion choices using the returned averaged log-probabilities. Defaults to False.
-- `**kwargs`: Additional keyword arguments for completion request.
-
-**Returns:**
-- `List[Dict[str, Any]]`: List of completion choices.
diff --git a/docs/api/language_model_clients/HFClientVLLM.md b/docs/api/language_model_clients/HFClientVLLM.md
deleted file mode 100644
index 347ce89eb..000000000
--- a/docs/api/language_model_clients/HFClientVLLM.md
+++ /dev/null
@@ -1,23 +0,0 @@
----
-sidebar_position: 5
----
-
-# dspy.HFClientVLLM
-
-### Usage
-
-```python
-lm = dspy.HFClientVLLM(model="meta-llama/Llama-2-7b-hf", port=8080, url="http://localhost")
-```
-
-### Prerequisites
-
-Refer to the [vLLM Server](https://dspy-docs.vercel.app/api/language_model_clients/HFClientVLLM) section of the `Using Local Models` documentation.
-
-### Constructor
-
-Refer to [`dspy.TGI`](https://dspy-docs.vercel.app/api/language_model_clients/TGI) documentation. Replace with `HFClientVLLM`.
-
-### Methods
-
-Refer to [`dspy.OpenAI`](https://dspy-docs.vercel.app/api/language_model_clients/OpenAI) documentation.
\ No newline at end of file
diff --git a/docs/api/language_model_clients/Mistral.md b/docs/api/language_model_clients/Mistral.md
deleted file mode 100644
index e7a4a7fe0..000000000
--- a/docs/api/language_model_clients/Mistral.md
+++ /dev/null
@@ -1,34 +0,0 @@
----
-sidebar_position: 9
----
-
-# dspy.Mistral
-
-### Usage
-
-```python
-lm = dspy.Mistral(model='mistral-medium-latest', api_key="your-mistralai-api-key")
-```
-
-### Constructor
-
-The constructor initializes the base class `LM` and verifies the `api_key` provided or defined through the `MISTRAL_API_KEY` environment variable.
-
-```python
-class Mistral(LM):
- def __init__(
- self,
- model: str = "mistral-medium-latest",
- api_key: Optional[str] = None,
- **kwargs,
- ):
-```
-
-**Parameters:**
-- `model` (_str_): Mistral AI pretrained models. Defaults to `mistral-medium-latest`.
-- `api_key` (_Optional[str]_, _optional_): API provider from Mistral AI. Defaults to None.
-- `**kwargs`: Additional language model arguments to pass to the API provider.
-
-### Methods
-
-Refer to [`dspy.OpenAI`](https://dspy-docs.vercel.app/api/language_model_clients/OpenAI) documentation.
diff --git a/docs/api/language_model_clients/MultiOpenAI.md b/docs/api/language_model_clients/MultiOpenAI.md
deleted file mode 100644
index 9303b10a6..000000000
--- a/docs/api/language_model_clients/MultiOpenAI.md
+++ /dev/null
@@ -1,69 +0,0 @@
----
-sidebar_position: 14
----
-
-# dspy.MultiOpenAI
-
-### Usage
-
-```python
-openrouter = dspy.MultiOpenAI(model='openai/gpt-4o-mini',
- api_key='xxxx',
- api_provider='openrouter',
- api_base='https://openrouter.ai/api/v1/',
- model_type='chat',
- )
-
-siliconflow = dspy.MultiOpenAI(model='zhipuai/glm4-9B-chat',
- api_key='xxxx',
- api_provider='siliconflow',
- api_base='https://api.siliconflow.cn/v1/',
- model_type='chat',
- )
-```
-
-### Constructor
-
-The constructor initializes the base class `LM` and verifies the provided arguments like the `model`, `api_provider`, `api_key`, and `api_base` to set up OpenAI request retrieval. The `kwargs` attribute is initialized with default values for relevant text generation parameters needed for communicating with the GPT API, such as `temperature`, `max_tokens`, `top_p`, `frequency_penalty`, `presence_penalty`, and `n`.
-
-```python
-class MultiOpenAI(LM):
- def __init__(
- self,
- model: str,
- api_key: Optional[str],
- api_provider: str,
- api_base: str,
- model_type: Literal["chat", "text"] = "chat",
- system_prompt: Optional[str] = None,
- **kwargs,
- ):
-```
-
-
-
-**Parameters:**
-- `model` (str): LLM model to use.
-- `api_key` (Optional[str]): API provider Authentication token.
-- `api_provider` (str): The API provider to use.
-- `model_type` (_Literal["chat", "text"]_): The type of model that was specified. Mainly to decide the optimal prompting strategy. Defaults to "chat".
-- `**kwargs`: Additional language model arguments to pass to the API provider.
-
-### Methods
-
-#### `__call__(self, prompt: str, only_completed: bool = True, return_sorted: bool = False, **kwargs) -> List[Dict[str, Any]]`
-
-Retrieves completions from OpenAI by calling `request`.
-
-Internally, the method handles the specifics of preparing the request prompt and corresponding payload to obtain the response.
-
-After generation, the completions are post-processed based on the `model_type` parameter. If the parameter is set to 'chat', the generated content look like `choice["message"]["content"]`. Otherwise, the generated text will be `choice["text"]`.
-
-**Parameters:**
-- `prompt` (_str_): Prompt to send to OpenAI.
-- `only_completed` (_bool_, _optional_): Flag to return only completed responses and ignore completion due to length. Defaults to True.
-- `return_sorted` (_bool_, _optional_): Flag to sort the completion choices using the returned averaged log-probabilities. Defaults to False.
-- `**kwargs`: Additional keyword arguments for completion request.
-
-**Returns:**
-- `List[Dict[str, Any]]`: List of completion choices.
diff --git a/docs/api/language_model_clients/OpenAI.md b/docs/api/language_model_clients/OpenAI.md
deleted file mode 100644
index 414a3afdc..000000000
--- a/docs/api/language_model_clients/OpenAI.md
+++ /dev/null
@@ -1,54 +0,0 @@
----
-sidebar_position: 1
----
-
-# dspy.OpenAI
-
-### Usage
-
-```python
-lm = dspy.OpenAI(model='gpt-3.5-turbo')
-```
-
-### Constructor
-
-The constructor initializes the base class `LM` and verifies the provided arguments like the `api_provider`, `api_key`, and `api_base` to set up OpenAI request retrieval. The `kwargs` attribute is initialized with default values for relevant text generation parameters needed for communicating with the GPT API, such as `temperature`, `max_tokens`, `top_p`, `frequency_penalty`, `presence_penalty`, and `n`.
-
-```python
-class OpenAI(LM):
- def __init__(
- self,
- model: str = "text-davinci-002",
- api_key: Optional[str] = None,
- api_provider: Literal["openai"] = "openai",
- model_type: Literal["chat", "text"] = None,
- **kwargs,
- ):
-```
-
-
-
-**Parameters:**
-- `api_key` (_Optional[str]_, _optional_): API provider authentication token. Defaults to None.
-- `api_provider` (_Literal["openai"]_, _optional_): API provider to use. Defaults to "openai".
-- `model_type` (_Literal["chat", "text"]_): Specified model type to use.
-- `**kwargs`: Additional language model arguments to pass to the API provider.
-
-### Methods
-
-#### `__call__(self, prompt: str, only_completed: bool = True, return_sorted: bool = False, **kwargs) -> List[Dict[str, Any]]`
-
-Retrieves completions from OpenAI by calling `request`.
-
-Internally, the method handles the specifics of preparing the request prompt and corresponding payload to obtain the response.
-
-After generation, the completions are post-processed based on the `model_type` parameter. If the parameter is set to 'chat', the generated content look like `choice["message"]["content"]`. Otherwise, the generated text will be `choice["text"]`.
-
-**Parameters:**
-- `prompt` (_str_): Prompt to send to OpenAI.
-- `only_completed` (_bool_, _optional_): Flag to return only completed responses and ignore completion due to length. Defaults to True.
-- `return_sorted` (_bool_, _optional_): Flag to sort the completion choices using the returned averaged log-probabilities. Defaults to False.
-- `**kwargs`: Additional keyword arguments for completion request.
-
-**Returns:**
-- `List[Dict[str, Any]]`: List of completion choices.
\ No newline at end of file
diff --git a/docs/api/language_model_clients/PremAI.md b/docs/api/language_model_clients/PremAI.md
deleted file mode 100644
index d9f6aaf61..000000000
--- a/docs/api/language_model_clients/PremAI.md
+++ /dev/null
@@ -1,186 +0,0 @@
----
-sidebar_position: 5
----
-
-# dspy.PremAI
-
-[PremAI](https://app.premai.io) is an all-in-one platform that simplifies the process of creating robust, production-ready applications powered by Generative AI. By streamlining the development process, PremAI allows you to concentrate on enhancing user experience and driving overall growth for your application.
-
-### Prerequisites
-
-Refer to the [quick start](https://docs.premai.io/introduction) guide to getting started with the PremAI platform, create your first project and grab your API key.
-
-### Usage
-
-Please make sure you have premai python sdk installed. Otherwise you can do it using this command:
-
-```bash
-pip install -U premai
-```
-
-Here is a quick example on how to use premai python sdk with DSPy
-
-```python
-from dspy import PremAI
-
-llm = PremAI(model='mistral-tiny', project_id=123, api_key="your-premai-api-key")
-print(llm("what is a large language model"))
-```
-
-> Please note: Project ID 123 is just an example. You can find your project ID inside our platform under which you created your project.
-
-### Constructor
-
-The constructor initializes the base class `LM` and verifies the `api_key` provided or defined through the `PREMAI_API_KEY` environment variable.
-
-```python
-class PremAI(LM):
- def __init__(
- self,
- model: str,
- project_id: int,
- api_key: str,
- base_url: Optional[str] = None,
- session_id: Optional[int] = None,
- **kwargs,
- ) -> None:
-```
-
-**Parameters:**
-
-- `model` (_str_): Models supported by PremAI. Example: `mistral-tiny`. We recommend using the model selected in [project launchpad](https://docs.premai.io/get-started/launchpad).
-- `project_id` (_int_): The [project id](https://docs.premai.io/get-started/projects) which contains the model of choice.
-- `api_key` (_Optional[str]_, _optional_): API provider from PremAI. Defaults to None.
-- `**kwargs`: Additional language model arguments will be passed to the API provider.
-
-### Methods
-
-#### `__call__(self, prompt: str, **kwargs) -> List[Dict[str, Any]]`
-
-Retrieves completions from PremAI by calling `request`.
-
-Internally, the method handles the specifics of preparing the request prompt and corresponding payload to obtain the response.
-
-**Parameters:**
-
-- `prompt` (_str_): Prompt to send to PremAI.
-- `**kwargs`: Additional keyword arguments for completion request. Example: parameters like `temperature`, `max_tokens` etc. You can find all the additional kwargs [here](https://docs.premai.io/get-started/sdk#optional-parameters).
-
-### Prem Templates
-
-Writing Prompt Templates can be super messy. Prompt templates are long, hard to manage, and must be continuously tweaked to improve and keep the same throughout the application.
-
-With **Prem**, writing and managing prompts can be super easy. The **_Templates_** tab inside the [launchpad](https://docs.premai.io/get-started/launchpad) helps you write as many prompts as you need and use it inside the SDK to make your application run using those prompts. You can read more about Prompt Templates [here](https://docs.premai.io/get-started/prem-templates).
-
-Using templates in DSPy is quite easy. First, here is an example of a prompt template that you store / re-iterate inside Prem.
-
-```python
-template = """
-Summarize the following content by creating a bullet point list and return it in json
-${content}
-"""
-```
-
-**Please note:** Prompt templates are not defined in Python code. Here is an example of a Template, which has an associated template id.
-
-Assuming this prompt template is stored under a template with id: `78069ce8-xxxxx-xxxxx-xxxx-xxx`:
-
-```python
-from dspy import PremAI
-
-client = PremAI(project_id=1234)
-template_id = "78069ce8-xxxxx-xxxxx-xxxx-xxx"
-
-msg = """
-I am playing in a garden on a fine sunday
-evening. I then went to my friend Tara's place
-and then went for movies in the city center mall.
-"""
-
-response = client(
- prompt="some-random-dummy-text",
- template_id=template_id,
- params={"content": msg}
-)
-
-print(response)
-```
-
-When you use templates, there is no need to place `msg` / prompt inside the `prompt` argument. DSPy only accepts string prompts to conduct LLM requests, but we might require multiple string inputs when using templates. Templates allow you to provide additional inputs (key:value pairs) within the `params` argument, which should be mapped with the template variable. Our example template had one variable `content`, so our params become: `{"content": msg}`.
-
-### Native RAG Support
-
-PremAI Repositories allow users to upload documents (.txt, .pdf, etc.) and connect those repositories to the LLMs to serve as vector databases and support native RAG. You can learn more about PremAI repositories [here](https://docs.premai.io/get-started/repositories).
-
-Repositories are also supported through the dspy-premai integration. Here is how you can use this workflow:
-
-```python
-query = "what is the diameter of individual Galaxy"
-repository_ids = [1991, ]
-repositories = dict(
- ids=repository_ids,
- similarity_threshold=0.3,
- limit=3
-)
-```
-
-First, we start by defining our repository with some valid repository ids. You can learn more about how to get the repository id [here](https://docs.premai.io/get-started/repositories).
-
-> Note: This is similar to LM integrations where now you are overriding the repositories connected in the launchpad when you invoke the argument' repositories'.
-
-Now, we connect the repository with our chat object to invoke RAG-based generations.
-
-```python
-response = llm(query, max_tokens=100, repositories=repositories)
-
-print(response)
-print("---")
-print(json.dumps(llm.history, indent=4))
-```
-
-Here is what an example generation would look like with PremAI Repositories.
-
-```bash
-'The diameters of individual galaxies range from 80,000-150,000 light-years.'
----
-[
- {
- "prompt": "what is the diameter of individual Galaxy",
- "response": "The diameters of individual galaxies range from 80,000-150,000 light-years.",
- "document_chunks": [
- {
- "repository_id": 1991,
- "document_id": 1307,
- "chunk_id": 173926,
- "document_name": "Kegy 202 Chapter 2",
- "similarity_score": 0.586126983165741,
- "content": "n thousands\n of light-years. The diameters of individual\n galaxies range from 80,000-150,000 light\n "
- },`
- ],
- "kwargs": {
- "max_tokens": 100,
- "repositories": {
- "ids": [
- 1991
- ],
- "similarity_threshold": 0.3,
- "limit": 3
- }
- },
- "raw_kwargs": {
- "max_tokens": 100,
- "repositories": {
- "ids": [
- 1991
- ],
- "similarity_threshold": 0.3,
- "limit": 3
- }
- }
- }
-]
-```
-
-So this also means that you do not need to create your own RAG pipeline when using the PremAI Platform and can instead take advantage of its local RAG technology to deliver best-in-class performance for Retrieval Augmented Generations.
-
-> Ideally, you do not need to connect Repository IDs here to get Retrieval Augmented Generations. You can still get the same result if you have connected the repositories in PremAI platform.
diff --git a/docs/api/language_model_clients/Snowflake.md b/docs/api/language_model_clients/Snowflake.md
deleted file mode 100644
index ac3002821..000000000
--- a/docs/api/language_model_clients/Snowflake.md
+++ /dev/null
@@ -1,52 +0,0 @@
----
-sidebar_position: 12
----
-
-# dspy.Snowflake
-
-### Usage
-
-```python
-import dspy
-import os
-from snowflake.snowpark import Session
-
-connection_parameters = {
-
- "account": os.getenv('SNOWFLAKE_ACCOUNT'),
- "user": os.getenv('SNOWFLAKE_USER'),
- "password": os.getenv('SNOWFLAKE_PASSWORD'),
- "role": os.getenv('SNOWFLAKE_ROLE'),
- "warehouse": os.getenv('SNOWFLAKE_WAREHOUSE'),
- "database": os.getenv('SNOWFLAKE_DATABASE'),
- "schema": os.getenv('SNOWFLAKE_SCHEMA')}
-
-# Establish connection to Snowflake
-snowpark = Session.builder.configs(connection_parameters).create()
-
-# Initialize Snowflake Cortex LM
-lm = dspy.Snowflake(session=snowpark,model="mixtral-8x7b")
-```
-
-### Constructor
-
-The constructor inherits from the base class `LM` and verifies the `session` for using Snowflake API.
-
-```python
-class Snowflake(LM):
- def __init__(
- self,
- session,
- model,
- **kwargs):
-```
-
-**Parameters:**
-
-- `session` (_object_): Snowflake connection object enabled by the [snowflake snowpark session](https://docs.snowflake.com/en/developer-guide/snowpark/reference/python/latest/snowpark/api/snowflake.snowpark.Session)
-- `model` (_str_): model hosted by [Snowflake Cortex](https://docs.snowflake.com/en/user-guide/snowflake-cortex/llm-functions#availability).
- snowpark/reference/python/latest/api/snowflake.snowpark.Session)
-
-### Methods
-
-Refer to [`dspy.Snowflake`](https://dspy-docs.vercel.app/api/language_model_clients/Snowflake) documentation.
diff --git a/docs/api/language_model_clients/TGI.md b/docs/api/language_model_clients/TGI.md
deleted file mode 100644
index c44902349..000000000
--- a/docs/api/language_model_clients/TGI.md
+++ /dev/null
@@ -1,34 +0,0 @@
----
-sidebar_position: 4
----
-
-# dspy.HFClientTGI
-
-### Usage
-
-```python
-lm = dspy.HFClientTGI(model="meta-llama/Llama-2-7b-hf", port=8080, url="http://localhost")
-```
-
-### Prerequisites
-
-Refer to the [Text Generation-Inference Server](https://dspy-docs.vercel.app/docs/deep-dive/language_model_clients/local_models/HFClientTGI) section of the `Using Local Models` documentation.
-
-### Constructor
-
-The constructor initializes the `HFModel` base class and configures the client for communicating with the TGI server. It requires a `model` instance, communication `port` for the server, and the `url` for the server to host generate requests. Additional configuration can be provided via keyword arguments in `**kwargs`.
-
-```python
-class HFClientTGI(HFModel):
- def __init__(self, model, port, url="http://future-hgx-1", **kwargs):
-```
-
-**Parameters:**
-- `model` (_HFModel_): Instance of Hugging Face model connected to the TGI server.
-- `port` (_int_): Port for TGI server.
-- `url` (_str_): Base URL where the TGI server is hosted.
-- `**kwargs`: Additional keyword arguments to configure the client.
-
-### Methods
-
-Refer to [`dspy.OpenAI`](https://dspy-docs.vercel.app/api/language_model_clients/OpenAI) documentation.
\ No newline at end of file
diff --git a/docs/api/language_model_clients/Together.md b/docs/api/language_model_clients/Together.md
deleted file mode 100644
index c6baccf6d..000000000
--- a/docs/api/language_model_clients/Together.md
+++ /dev/null
@@ -1,32 +0,0 @@
----
-sidebar_position: 7
----
-
-# dspy.Together
-
-### Usage
-
-```python
-lm = dspy.Together(model="mistralai/Mistral-7B-v0.1")
-```
-
-### Constructor
-
-The constructor initializes the base class `LM` and verifies the `api_key` for using Together API.
-We expect the following environment variables to be set:
-- `TOGETHER_API_KEY`: API key for Together.
-- `TOGETHER_API_BASE`: API base URL for Together.
-
-
-```python
-class Together(HFModel):
- def __init__(self, model, **kwargs):
-```
-
-**Parameters:**
-- `model` (_str_): models hosted on Together.
-- `stop` (_List[str]_, _optional_): List of stopping tokens to end generation.
-
-### Methods
-
-Refer to [`dspy.OpenAI`](https://dspy-docs.vercel.app/api/language_model_clients/OpenAI) documentation.
\ No newline at end of file
diff --git a/docs/api/language_model_clients/Watsonx.md b/docs/api/language_model_clients/Watsonx.md
deleted file mode 100644
index b6ef27bdb..000000000
--- a/docs/api/language_model_clients/Watsonx.md
+++ /dev/null
@@ -1,59 +0,0 @@
----
-sidebar_position: 12
----
-
-# dspy.Watsonx
-
-This guide provides instructions on how to use the `Watsonx` class to interact with IBM Watsonx.ai API for text and code generation.
-
-## Requirements
-
-- Python 3.10 or higher.
-- The `ibm-watsonx-ai` package installed, which can be installed via pip.
-- An IBM Cloud account and a Watsonx configured project.
-
-## Installation
-
-Ensure you have installed the `ibm-watsonx-ai` package along with other necessary dependencies:
-
-## Configuration
-
-Before using the `Watsonx` class, you need to set up access to IBM Cloud:
-
-1. Create an IBM Cloud account
-2. Enable a Watsonx service from the catalog
-3. Create a new project and associate a Watson Machine Learning service instance.
-4. Create an IAM authentication credentials and save them in a JSON file.
-
-## Usage
-
-Here's an example of how to instantiate the `Watsonx` class and send a generation request:
-
-```python
-import dspy
-
-''' Initialize the class with the model name and parameters for Watsonx.ai
- You can choose between many different models:
- * (Mistral) mistralai/mixtral-8x7b-instruct-v01
- * (Meta) meta-llama/llama-3-70b-instruct
- * (IBM) ibm/granite-13b-instruct-v2
- * and many others.
-'''
-watsonx=dspy.Watsonx(
- model='mistralai/mixtral-8x7b-instruct-v01',
- credentials={
- "apikey": "your-api-key",
- "url": "https://us-south.ml.cloud.ibm.com"
- },
- project_id="your-watsonx-project-id",
- max_new_tokens=500,
- max_tokens=1000
- )
-
-dspy.settings.configure(lm=watsonx)
-```
-
-## Customizing Requests
-
-You can customize requests by passing additional parameters such as `decoding_method`,`max_new_tokens`, `stop_sequences`, `repetition_penalty`, and others supported by the Watsonx.ai API. This allows you to control the behavior of the generation.
-Refer to [`ibm-watsonx-ai library`](https://ibm.github.io/watsonx-ai-python-sdk/index.html) documentation.
diff --git a/docs/api/language_model_clients/You.md b/docs/api/language_model_clients/You.md
deleted file mode 100644
index 3069fdcdc..000000000
--- a/docs/api/language_model_clients/You.md
+++ /dev/null
@@ -1,46 +0,0 @@
----
-sidebar_position: 13
----
-
-# dspy.You
-Wrapper around [You.com's conversational Smart and Research APIs](https://documentation.you.com/api-reference/).
-
-Each API endpoint is designed to generate conversational
-responses to a variety of query types, including inline citations
-and web results when relevant.
-
-Smart Mode:
-- Quick, reliable answers for a variety of questions
-- Cites the entire web page URL
-
-Research Mode:
-- In-depth answers with extensive citations for a variety of questions
-- Cites the specific web page snippet relevant to the claim
-
-For more information, check out the documentations at
-https://documentation.you.com/api-reference/.
-
-
-### Constructor
-```python
-You(
- endpoint: Literal["smart", "research"] = "smart",
- ydc_api_key: Optional[str] = None,
-)
-```
-
-**Parameters:**
-- `endpoint`: You.com conversational endpoints. Choose from "smart" or "research"
-- `ydc_api_key`: You.com API key, if `YDC_API_KEY` is not set in the environment
-
-### Usage
-Obtain a You.com API key from https://api.you.com/.
-
-Export this key to an environment variable `YDC_API_KEY`.
-
-```python
-import dspy
-
-# The API key is inferred from the `YDC_API_KEY` environment variable
-lm = dspy.You(endpoint="smart")
-```
diff --git a/docs/api/language_model_clients/_category_.json b/docs/api/language_model_clients/_category_.json
deleted file mode 100644
index 1527ce187..000000000
--- a/docs/api/language_model_clients/_category_.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "label": "Language Model API Clients",
- "position": 5,
- "link": {
- "type": "generated-index",
- "description": "This documentation provides an overview of the DSPy Language Model Clients."
- }
-}
\ No newline at end of file
diff --git a/docs/api/language_model_clients/aws_models.md b/docs/api/language_model_clients/aws_models.md
deleted file mode 100644
index 143c48446..000000000
--- a/docs/api/language_model_clients/aws_models.md
+++ /dev/null
@@ -1,86 +0,0 @@
----
-sidebar_position: 9
----
-
-# dspy.AWSMistral, dspy.AWSAnthropic, dspy.AWSMeta
-
-### Usage
-
-```python
-# Notes:
-# 1. Install boto3 to use AWS models.
-# 2. Configure your AWS credentials with the AWS CLI before using these models
-
-# initialize the bedrock aws provider
-bedrock = dspy.Bedrock(region_name="us-west-2")
-# For mixtral on Bedrock
-lm = dspy.AWSMistral(bedrock, "mistral.mixtral-8x7b-instruct-v0:1", **kwargs)
-# For haiku on Bedrock
-lm = dspy.AWSAnthropic(bedrock, "anthropic.claude-3-haiku-20240307-v1:0", **kwargs)
-# For llama2 on Bedrock
-lm = dspy.AWSMeta(bedrock, "meta.llama2-13b-chat-v1", **kwargs)
-
-# initialize the sagemaker aws provider
-sagemaker = dspy.Sagemaker(region_name="us-west-2")
-# For mistral on Sagemaker
-# Note: you need to create a Sagemaker endpoint for the mistral model first
-lm = dspy.AWSMistral(sagemaker, "<YOUR_MISTRAL_ENDPOINT_NAME>", **kwargs)
-
-```
-
-### Constructor
-
-The `AWSMistral` constructor initializes the base class `AWSModel` which itself inherits from the `LM` class.
-
-```python
-class AWSMistral(AWSModel):
- """Mistral family of models."""
-
- def __init__(
- self,
- aws_provider: AWSProvider,
- model: str,
- max_context_size: int = 32768,
- max_new_tokens: int = 1500,
- **kwargs
- ) -> None:
-```
-
-**Parameters:**
-- `aws_provider` (AWSProvider): The aws provider to use. One of `dspy.Bedrock` or `dspy.Sagemaker`.
-- `model` (_str_): Mistral AI pretrained models. For Bedrock, this is the Model ID in https://docs.aws.amazon.com/bedrock/latest/userguide/model-ids.html#model-ids-arns. For Sagemaker, this is the endpoint name.
-- `max_context_size` (_Optional[int]_, _optional_): Max context size for this model. Defaults to 32768.
-- `max_new_tokens` (_Optional[int]_, _optional_): Max new tokens possible for this model. Defaults to 1500.
-- `**kwargs`: Additional language model arguments to pass to the API provider.
-
-### Methods
-
-```python
-def _format_prompt(self, raw_prompt: str) -> str:
-```
-This function formats the prompt for the model. Refer to the model card for the specific formatting required.
-
-<br/>
-
-```python
-def _create_body(self, prompt: str, **kwargs) -> tuple[int, dict[str, str | float]]:
-```
-This function creates the body of the request to the model. It takes the prompt and any additional keyword arguments and returns a tuple of the number of tokens to generate and a dictionary of keys including the prompt used to create the body of the request.
-
-<br/>
-
-```python
-def _call_model(self, body: str) -> str:
-```
-This function calls the model using the provider `call_model()` function and extracts the generated text (completion) from the provider-specific response.
-
-<br/>
-
-The above model-specific methods are called by the `AWSModel::basic_request()` method, which is the main method for querying the model. This method takes the prompt and any additional keyword arguments and calls the `AWSModel::_simple_api_call()` which then delegates to the model-specific `_create_body()` and `_call_model()` methods to create the body of the request, call the model and extract the generated text.
-
-
-Refer to [`dspy.OpenAI`](https://dspy-docs.vercel.app/api/language_model_clients/OpenAI) documentation for information on the `LM` base class functionality.
-
-<br/>
-
-`AWSAnthropic` and `AWSMeta` work exactly the same as `AWSMistral`.
diff --git a/docs/api/language_model_clients/aws_providers.md b/docs/api/language_model_clients/aws_providers.md
deleted file mode 100644
index 46950db9e..000000000
--- a/docs/api/language_model_clients/aws_providers.md
+++ /dev/null
@@ -1,53 +0,0 @@
----
-sidebar_position: 9
----
-
-# dspy.Bedrock, dspy.Sagemaker
-
-### Usage
-
-The `AWSProvider` class is the base class for the AWS providers - `dspy.Bedrock` and `dspy.Sagemaker`. An instance of one of these providers is passed to the constructor when creating an instance of an AWS model class (e.g., `dspy.AWSMistral`) that is ultimately used to query the model.
-
-```python
-# Notes:
-# 1. Install boto3 to use AWS models.
-# 2. Configure your AWS credentials with the AWS CLI before using these models
-
-# initialize the bedrock aws provider
-bedrock = dspy.Bedrock(region_name="us-west-2")
-
-# initialize the sagemaker aws provider
-sagemaker = dspy.Sagemaker(region_name="us-west-2")
-```
-
-### Constructor
-
-The `Bedrock` constructor initializes the base class `AWSProvider`.
-
-```python
-class Bedrock(AWSProvider):
- """This class adds support for Bedrock models."""
-
- def __init__(
- self,
- region_name: str,
- profile_name: Optional[str] = None,
- batch_n_enabled: bool = False, # This has to be setup manually on Bedrock.
- ) -> None:
-```
-
-**Parameters:**
-- `region_name` (str): The AWS region where this LM is hosted.
-- `profile_name` (str, optional): boto3 credentials profile.
-- `batch_n_enabled` (bool): If False, call the LM N times rather than batching.
-
-### Methods
-
-```python
-def call_model(self, model_id: str, body: str) -> str:
-```
-This function implements the actual invocation of the model on AWS using the boto3 provider.
-
-<br/>
-
-`Sagemaker` works exactly the same as `Bedrock`.
\ No newline at end of file
diff --git a/docs/api/language_model_clients/langfuse.md b/docs/api/language_model_clients/langfuse.md
deleted file mode 100644
index 2b453c116..000000000
--- a/docs/api/language_model_clients/langfuse.md
+++ /dev/null
@@ -1,67 +0,0 @@
-# Prompt Visiblity through Langfuse
-
-We have now integrated Langfuse as one of the trackers.
-
-## What is Langfuse?
-
-Langfuse ([GitHub](https://github.com/langfuse/langfuse)) is an open-source LLM engineering and observability platform for model [tracing](https://langfuse.com/docs/tracing), [prompt management](https://langfuse.com/docs/prompts/get-started), and application [evaluation](https://langfuse.com/docs/scores/overview). Langfuse enables teams to collaboratively debug, analyze, and refine their LLM applications.
-
-To get started, you can [self-host](https://langfuse.com/docs/deployment/self-host) Langfuse or use the Langfuse [cloud](https://cloud.langfuse.com/).
-
-### Install Langfuse.
-
-```shell
-pip install langfuse
-```
-
-Next, configure the following environment variables: `LANGFUSE_SECRET_KEY`、`LANGFUSE_PUBLIC_KEY` and `LANGFUSE_HOST`. You can get your Langfuse API keys by navigating to **Project** -> **Settings** within Langfuse.
-
-```python
-import os
-
-# Get keys for your project from the project settings page
-# https://cloud.langfuse.com
-os.environ["LANGFUSE_SECRET_KEY"] = "sk-..."
-os.environ["LANGFUSE_PUBLIC_KEY"] = "pk-..."
-os.environ["LANGFUSE_HOST"] = "https://cloud.langfuse.com" # 🇪🇺 EU region
-# os.environ["LANGFUSE_HOST"] = "https://us.cloud.langfuse.com" # 🇺🇸 US region
-```
-
-If you are using **openai** or **azure_openai**, your LMs are configured.
-
-For other LM providers, you need to configure the Langfuse tracker and call it manually.
-
-### Example
-
-```python
-import dspy
-from dsp.trackers.langfuse_tracker import LangfuseTracker
-# e.g:
-# Assuming the environment variables have been set
-langfuse = LangfuseTracker()
-turbo = dspy.OllamaLocal()
-dspy.settings.configure(lm=turbo)
-
-completions = turbo("Hi,how's it going today?")
-turbo.tracker_call(tracker=langfuse)
-```
-
-Example trace in Langfuse: https://cloud.langfuse.com/project/cloramnkj0002jz088vzn1ja4/traces/5abece99-91bf-414e-a952-407ba8401c98
-
-### Custom Tracker
-
-We also provide `BaseTracker`: simply inherit it and override the `call()` method
-```python
-# custom_tracker.py
-from dsp.trackers.base import BaseTracker
-
-class CustomTracker(BaseTracker):
-
- def call(self, *args, **kwargs):
- pass
-
-```
-
-### Resources
-
-Have a look at the [DSPy cookbook](https://langfuse.com/docs/integrations/dspy) in the Langfuse docs for an end-to-end example.
diff --git a/docs/api/local_language_model_clients/HFModel.md b/docs/api/local_language_model_clients/HFModel.md
deleted file mode 100644
index 162238ae5..000000000
--- a/docs/api/local_language_model_clients/HFModel.md
+++ /dev/null
@@ -1,7 +0,0 @@
-# dspy.HFModel
-
-Initialize `HFModel` within your program with the desired model to load in. Here's an example call:
-
-```python
-llama = dspy.HFModel(model = 'meta-llama/Llama-2-7b-hf')
-```
\ No newline at end of file
diff --git a/docs/api/local_language_model_clients/LlamaCpp.md b/docs/api/local_language_model_clients/LlamaCpp.md
deleted file mode 100644
index 47120d65b..000000000
--- a/docs/api/local_language_model_clients/LlamaCpp.md
+++ /dev/null
@@ -1,62 +0,0 @@
-# dspy.LlamaCpp
-
-## Prerequisites
-
-Install Llama Cpp Python by following the instructions provided in the [Llama Cpp Python repository](https://github.com/abetlen/llama-cpp-python).
-
-```shell
-pip install llama-cpp-python
-```
-
-alternatively, to install with CUDA support:
-
-```shell
-CMAKE_ARGS="-DGGML_CUDA=on" pip install llama-cpp-python
-```
-
-
-### Initializing the Llama model
-
-Initialize the model within your program with the desired parameters.
-
-```python
-from llama_cpp import Llama
-
-llm = Llama(
- model_path="./sppo_finetuned_llama_3_8b.gguf",
- n_gpu_layers=-1,
- n_ctx=0,
- verbose=False
-)
-```
-
-
-### Sending requests to the model
-
-After initializing the Llama model, you can interact with it using the `LlamaCpp` client.
-
-```python
-import dspy
-
-llamalm = dspy.LlamaCpp(model="llama", llama_model=llm, model_type="chat", temperature=0.4)
-dspy.settings.configure(lm=llamalm)
-
-
-#Define a simple signature for basic question answering
-class BasicQA(dspy.Signature):
- """Answer questions with short factoid answers."""
- question = dspy.InputField()
- answer = dspy.OutputField(desc="often between 1 and 5 words")
-
-#Pass signature to Predict module
-generate_answer = dspy.Predict(BasicQA)
-
-# Call the predictor on a particular input.
-question='What is the color of the sky?'
-pred = generate_answer(question=question)
-
-print(f"Question: {question}")
-print(f"Predicted Answer: {pred.answer}")
-
-
-```
\ No newline at end of file
diff --git a/docs/api/local_language_model_clients/MLC.md b/docs/api/local_language_model_clients/MLC.md
deleted file mode 100644
index 6a36f374b..000000000
--- a/docs/api/local_language_model_clients/MLC.md
+++ /dev/null
@@ -1,41 +0,0 @@
-# dspy.ChatModuleClient
-
-## Prerequisites
-
-1. Install the required packages using the following commands:
-
- ```shell
- pip install --no-deps --pre --force-reinstall mlc-ai-nightly-cu118 mlc-chat-nightly-cu118 -f https://mlc.ai/wheels
- pip install transformers
- git lfs install
- ```
-
- Adjust the pip wheels according to your OS/platform by referring to the provided commands in [MLC packages](https://mlc.ai/package/).
-
-## Running MLC Llama-2 models
-
-1. Create a directory for prebuilt models:
-
- ```shell
- mkdir -p dist/prebuilt
- ```
-
-2. Clone the necessary libraries from the repository:
-
- ```shell
- git clone https://github.com/mlc-ai/binary-mlc-llm-libs.git dist/prebuilt/lib
- cd dist/prebuilt
- ```
-
-3. Choose a Llama-2 model from [MLC LLMs](https://huggingface.co/mlc-ai) and clone the model repository:
-
- ```shell
- git clone https://huggingface.co/mlc-ai/mlc-chat-Llama-2-7b-chat-hf-q4f16_1
- ```
-
-4. Initialize the `ChatModuleClient` within your program with the desired parameters. Here's an example call:
-
- ```python
- llama = dspy.ChatModuleClient(model='dist/prebuilt/mlc-chat-Llama-2-7b-chat-hf-q4f16_1', model_path='dist/prebuilt/lib/Llama-2-7b-chat-hf-q4f16_1-cuda.so')
- ```
-Please refer to the [official MLC repository](https://github.com/mlc-ai/mlc-llm) for more detailed information and [documentation](https://mlc.ai/mlc-llm/docs/get_started/try_out.html).
diff --git a/docs/api/local_language_model_clients/Ollama.md b/docs/api/local_language_model_clients/Ollama.md
deleted file mode 100644
index e7d8c3175..000000000
--- a/docs/api/local_language_model_clients/Ollama.md
+++ /dev/null
@@ -1,45 +0,0 @@
-# dspy.OllamaLocal
-
-:::note
-Adapted from documentation provided by https://github.com/insop
-:::
-
-Ollama is a good software tool that allows you to run LLMs locally, such as Mistral, Llama2, and Phi.
-The following are the instructions to install and run Ollama.
-
-### Prerequisites
-
-Install Ollama by following the instructions from this page:
-
-- https://ollama.ai
-
-Download model: `ollama pull`
-
-Download a model by running the `ollama pull` command. You can download Mistral, Llama2, and Phi.
-
-```bash
-# download mistral
-ollama pull mistral
-```
-
-Here is the list of other models you can download:
-- https://ollama.ai/library
-
-### Running Ollama model
-
-Run model: `ollama run`
-
-You need to start the model server with the `ollama run` command.
-
-```bash
-# run mistral
-ollama run mistral
-```
-
-### Sending requests to the server
-
-Here is the code to load a model through Ollama:
-
-```python
-lm = dspy.OllamaLocal(model='mistral')
-```
diff --git a/docs/api/local_language_model_clients/TGI.md b/docs/api/local_language_model_clients/TGI.md
deleted file mode 100644
index 0b8311cc8..000000000
--- a/docs/api/local_language_model_clients/TGI.md
+++ /dev/null
@@ -1,61 +0,0 @@
-# dspy.HFClientTGI
-
-## Prerequisites
-
-- Docker must be installed on your system. If you don't have Docker installed, you can get it from [here](https://docs.docker.com/get-docker/).
-
-## Setting up the Text-Generation-Inference Server
-
-1. Clone the Text-Generation-Inference repository from GitHub by executing the following command:
-
- ```
- git clone https://github.com/huggingface/text-generation-inference.git
- ```
-
-2. Change into the cloned repository directory:
-
- ```
- cd text-generation-inference
- ```
-
-3. Execute the Docker command under the "Get Started" section to run the server:
-
-
- ```
- model=meta-llama/Llama-2-7b-hf # set to the specific Hugging Face model ID you wish to use.
- num_shard=2 # set to the number of shards you wish to use.
- volume=$PWD/data # share a volume with the Docker container to avoid downloading weights every run
-
- docker run --gpus all --shm-size 1g -p 8080:80 -v $volume:/data ghcr.io/huggingface/text-generation-inference:0.9 --model-id $model --num-shard $num_shard
- ```
-
- This command will start the server and make it accessible at `http://localhost:8080`.
-
-If you want to connect to [Meta Llama 2 models](https://huggingface.co/meta-llama), make sure to use version 9.3 (or higher) of the docker image (ghcr.io/huggingface/text-generation-inference:0.9.3) and pass in your huggingface token as an environment variable.
-
-```
- docker run --gpus all --shm-size 1g -p 8080:80 -v $volume:/data -e HUGGING_FACE_HUB_TOKEN={your_token} ghcr.io/huggingface/text-generation-inference:0.9.3 --model-id $model --num-shard $num_shard
-```
-
-## Sending requests to the server
-
-After setting up the text-generation-inference server and ensuring that it displays "Connected" when it's running, you can interact with it using the `HFClientTGI`.
-
-Initialize the `HFClientTGI` within your program with the desired parameters. Here is an example call:
-
- ```python
- lm = dspy.HFClientTGI(model="meta-llama/Llama-2-7b-hf", port=8080, url="http://localhost")
- ```
-
- Customize the `model`, `port`, and `url` according to your requirements. The `model` parameter should be set to the specific Hugging Face model ID you wish to use.
-
-
-### FAQs
-
-1. If your model doesn't require any shards, you still need to set a value for `num_shard`, but you don't need to include the parameter `--num-shard` on the command line.
-
-2. If your model runs into any "token exceeded" issues, you can set the following parameters on the command line to adjust the input length and token limit:
- - `--max-input-length`: Set the maximum allowed input length for the text.
- - `--max-total-tokens`: Set the maximum total tokens allowed for text generation.
-
-Please refer to the [official Text-Generation-Inference repository](https://github.com/huggingface/text-generation-inference) for more detailed information and documentation.
diff --git a/docs/api/local_language_model_clients/TensorRTLLM.md b/docs/api/local_language_model_clients/TensorRTLLM.md
deleted file mode 100644
index 4fbd76309..000000000
--- a/docs/api/local_language_model_clients/TensorRTLLM.md
+++ /dev/null
@@ -1,82 +0,0 @@
-# dspy.TensorRTModel
-
-TensorRT LLM by Nvidia happens to be one of the most optimized inference engines to run open-source Large Language Models locally or in production.
-
-### Prerequisites
-
-Install TensorRT LLM by the following instructions [here](https://nvidia.github.io/TensorRT-LLM/installation/linux.html). You need to install `dspy` inside the same Docker environment in which `tensorrt` is installed.
-
-In order to use this module, you should have the model weights file in engine format. To understand how we convert weights in torch (from HuggingFace models) to TensorRT engine format, you can check out [this documentation](https://github.com/NVIDIA/TensorRT-LLM/tree/main/examples/llama#build-tensorrt-engines).
-
-### Running TensorRT model inside dspy
-
-```python
-from dspy import TensorRTModel
-
-engine_dir = "<your-path-to-engine-dir>"
-model_name_or_path = "<hf-model-id-or-path-to-tokenizer>"
-
-model = TensorRTModel(engine_dir=engine_dir, model_name_or_path=model_name_or_path)
-```
-
-You can perform more customization on model loading based on the following example. Below is a list of optional parameters that are supported while initializing the `dspy` TensorRT model.
-
-- **use_py_session** (`bool`, optional): Whether to use a Python session or not. Defaults to `False`.
-- **lora_dir** (`str`): The directory of LoRA adapter weights.
-- **lora_task_uids** (`List[str]`): List of LoRA task UIDs; use `-1` to disable the LoRA module.
-- **lora_ckpt_source** (`str`): The source of the LoRA checkpoint.
-
-If `use_py_session` is set to `False`, the following kwargs are supported (This runs in C++ runtime):
-
-- **max_batch_size** (`int`, optional): The maximum batch size. Defaults to `1`.
-- **max_input_len** (`int`, optional): The maximum input context length. Defaults to `1024`.
-- **max_output_len** (`int`, optional): The maximum output context length. Defaults to `1024`.
-- **max_beam_width** (`int`, optional): The maximum beam width, similar to `n` in OpenAI API. Defaults to `1`.
-- **max_attention_window_size** (`int`, optional): The attention window size that controls the sliding window attention / cyclic KV cache behavior. Defaults to `None`.
-- **sink_token_length** (`int`, optional): The sink token length. Defaults to `1`.
-
-> Please note that you need to complete the build processes properly before applying these customizations, because a lot of customization depends on how the model engine was built. You can learn more [here](https://github.com/NVIDIA/TensorRT-LLM/tree/main/examples/llama#build-tensorrt-engines).
-
-Now to run the model, we need to add the following code:
-
-```python
-response = model("hello")
-```
-
-This gives this result:
-
-```
-["nobody is perfect, and we all have our own unique struggles and challenges. But what sets us apart is how we respond to those challenges. Do we let them define us, or do we use them as opportunities to grow and learn?\nI know that I have my own personal struggles, and I'm sure you do too. But I also know that we are capable of overcoming them, and becoming the best versions of ourselves. So let's embrace our imperfections, and use them to fuel our growth and success.\nRemember, nobody is perfect, but everybody has the potential to be amazing. So let's go out there and make it happen!"]
-```
-
-You can also invoke chat mode by just changing the prompt to chat format like this:
-
-```python
-prompt = [{"role":"user", "content":"hello"}]
-response = model(prompt)
-
-print(response)
-```
-
-Output:
-
-```
-[" Hello! It's nice to meet you. Is there something I can help you with or would you like to chat?"]
-```
-
-Here are some optional parameters that are supported while doing generation:
-
-- **max_new_tokens** (`int`): The maximum number of tokens to output. Defaults to `1024`.
-- **max_attention_window_size** (`int`): Defaults to `None`.
-- **sink_token_length** (`int`): Defaults to `None`.
-- **end_id** (`int`): The end of sequence ID of the tokenizer, defaults to the tokenizer's default end ID.
-- **pad_id** (`int`): The pad sequence ID of the tokenizer, defaults to the tokenizer's default end ID.
-- **temperature** (`float`): The temperature to control probabilistic behavior in generation. Defaults to `1.0`.
-- **top_k** (`int`): Defaults to `1`.
-- **top_p** (`float`): Defaults to `1`.
-- **num_beams** (`int`): The number of responses to generate. Defaults to `1`.
-- **length_penalty** (`float`): Defaults to `1.0`.
-- **repetition_penalty** (`float`): Defaults to `1.0`.
-- **presence_penalty** (`float`): Defaults to `0.0`.
-- **frequency_penalty** (`float`): Defaults to `0.0`.
-- **early_stopping** (`int`): Use this only when `num_beams` > 1. Defaults to `1`.
diff --git a/docs/api/local_language_model_clients/_category_.json b/docs/api/local_language_model_clients/_category_.json
deleted file mode 100644
index 8965dcf41..000000000
--- a/docs/api/local_language_model_clients/_category_.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "label": "Local Language Model Clients",
- "position": 6,
- "link": {
- "type": "generated-index",
- "description": "DSPy supports various methods including `built-in wrappers`, `server integration`, and `external package integration` for model loading. This documentation provides a concise introduction on how to load in models within DSPy extending these capabilities for your specific needs."
- }
-}
\ No newline at end of file
diff --git a/docs/api/local_language_model_clients/vLLM.md b/docs/api/local_language_model_clients/vLLM.md
deleted file mode 100644
index d92aea5f4..000000000
--- a/docs/api/local_language_model_clients/vLLM.md
+++ /dev/null
@@ -1,40 +0,0 @@
-# dspy.HFClientVLLM
-
-### Setting up the vLLM Server
-
-Follow these steps to set up the vLLM Server:
-
-1. Build the server from source by following the instructions provided in the [Build from Source guide](https://vllm.readthedocs.io/en/latest/getting_started/installation.html#build-from-source).
-
-2. Start the server by running the following command, and specify your desired model, host, and port using the appropriate arguments. The default server address is http://localhost:8000.
-
-Example command:
-
-```bash
- python -m vllm.entrypoints.openai.api_server --model mosaicml/mpt-7b --port 8000
-```
-
-This will launch the vLLM server.
-
-### Sending requests to the server
-
-After setting up the vLLM server and ensuring that it displays "Connected" when it's running, you can interact with it using the `HFClientVLLM`.
-
-Initialize the `HFClientVLLM` within your program with the desired parameters. Here is an example call:
-
-```python
- lm = dspy.HFClientVLLM(model="mosaicml/mpt-7b", port=8000, url="http://localhost")
-```
-Customize the `model`, `port`, `url`, and `max_tokens` according to your requirements. The `model` parameter should be set to the specific Hugging Face model ID you wish to use.
-
-Please refer to the [official vLLM repository](https://github.com/vllm-project/vllm) for more detailed information and documentation.
-
-### Sending requests to vLLM server using [dspy.OpenAI](https://dspy-docs.vercel.app/api/language_model_clients/OpenAI)
-
-Query the vLLM server using OpenAI SDK through [`dspy.OpenAI`](https://dspy-docs.vercel.app/api/language_model_clients/OpenAI) with your desired parameters. Here is an example call:
-
-```python
- lm = dspy.OpenAI(model="mosaicml/mpt-7b", api_base="http://localhost:8000/v1/", api_key="EMPTY")
-```
-
-Similarly, customize the `model`, `port`, `url` (vLLM arguments), along with the remaining OpenAI client arguments according to your requirements. The `model` parameter should be set to the specific Hugging Face model ID you wish to use.
diff --git a/docs/api/modules/ChainOfThoughtWithHint.md b/docs/api/modules/ChainOfThoughtWithHint.md
deleted file mode 100644
index 26a41814d..000000000
--- a/docs/api/modules/ChainOfThoughtWithHint.md
+++ /dev/null
@@ -1,62 +0,0 @@
-# dspy.ChainOfThoughtWithHint
-
-### Constructor
-
-The constructor initializes the `ChainOfThoughtWithHint` class and sets up its attributes, inheriting from the `Predict` class. This class enhances the `ChainOfThought` class by offering an additional option to provide hints for reasoning. Two distinct signature templates are created internally depending on the presence of the hint.
-
-```python
-class ChainOfThoughtWithHint(Predict):
- def __init__(self, signature, rationale_type=None, activated=True, **config):
- super().__init__(signature, **config)
- self.activated = activated
- signature = self.signature
-
- *keys, last_key = signature.fields.keys()
- rationale_type = rationale_type or dspy.OutputField(
- prefix="Reasoning: Let's think step by step in order to",
- desc="${produce the " + last_key + "}. We ...",
- )
- self.extended_signature1 = self.signature.insert(-2, "rationale", rationale_type, type_=str)
-
- DEFAULT_HINT_TYPE = dspy.OutputField()
- self.extended_signature2 = self.extended_signature1.insert(-2, "hint", DEFAULT_HINT_TYPE, type_=str)
-```
-
-**Parameters:**
-- `signature` (_Any_): Signature of predictive model.
-- `rationale_type` (_dspy.OutputField_, _optional_): Rationale type for reasoning steps. Defaults to `None`.
-- `activated` (_bool_, _optional_): Flag for activated chain of thought processing. Defaults to `True`.
-- `**config` (_dict_): Additional configuration parameters for model.
-
-### Method
-
-#### `forward(self, **kwargs)`
-
-This method extends the parent `Predict` class's forward pass, updating the signature dynamically based on the presence of `hint` in the keyword arguments and the `activated` attribute.
-
-**Parameters:**
-- `**kwargs`: Keyword arguments required for prediction.
-
-**Returns:**
-- The result of the `forward` method in the parent `Predict` class.
-
-### Examples
-
-```python
-#Define a simple signature for basic question answering
-class BasicQA(dspy.Signature):
- """Answer questions with short factoid answers."""
- question = dspy.InputField()
- answer = dspy.OutputField(desc="often between 1 and 5 words")
-
-#Pass signature to ChainOfThought module
-generate_answer = dspy.ChainOfThoughtWithHint(BasicQA)
-
-# Call the predictor on a particular input alongside a hint.
-question='What is the color of the sky?'
-hint = "It's what you often see during a sunny day."
-pred = generate_answer(question=question, hint=hint)
-
-print(f"Question: {question}")
-print(f"Predicted Answer: {pred.answer}")
-```
diff --git a/docs/api/modules/ProgramOfThought.md b/docs/api/modules/ProgramOfThought.md
deleted file mode 100644
index 21a107902..000000000
--- a/docs/api/modules/ProgramOfThought.md
+++ /dev/null
@@ -1,99 +0,0 @@
-# dspy.ProgramOfThought
-
-### Constructor
-
-The constructor initializes the `ProgramOfThought` class and sets up its attributes. It is designed to generate and execute Python code based on input fields, producing a single output field through iterative refinement. It supports multiple iterations to refine the code in case of errors.
-
-```python
-import dsp
-import dspy
-from ..primitives.program import Module
-from ..primitives.python_interpreter import CodePrompt, PythonInterpreter
-import re
-
-class ProgramOfThought(Module):
- def __init__(self, signature, max_iters=3):
- ...
-```
-
-**Parameters:**
-- `signature` (_dspy.Signature_): Signature defining the input and output fields for the program.
-- `max_iters` (_int_, _optional_): Maximum number of iterations for refining the generated code. Defaults to `3`.
-
-### Methods
-
-#### `_generate_signature(self, mode)`
-
-Generates a signature dict for different modes: `generate`, `regenerate`, and `answer`.
-
-The `generate` mode serves as an initial generation of Python code with the signature (`question -> generated_code`).
-The `regenerate` mode serves as a refining generation of Python code, accounting for the past generated code and existing error with the signature (`question, previous_code, error -> generated_code`).
-The `answer` mode serves to execute the last stored generated code and output the final answer to the question with the signature (`question, final_generated_code, code_output -> answer`).
-
-**Parameters:**
-- `mode` (_str_): Mode of operation of Program of Thought.
-
-**Returns:**
-- A dictionary representing the signature for specified mode.
-
-#### `_generate_instruction(self, mode)`
-
-Generates instructions for code generation based on the mode. This ensures the signature accounts for relevant instructions in generating an answer to the inputted question by producing executable Python code.
-
-The instructional modes mirror the signature modes: `generate`, `regenerate`, `answer`
-
-**Parameters:**
-- `mode` (_str_): Mode of operation.
-
-**Returns:**
-- A string representing instructions for specified mode.
-
-#### `parse_code(self, code_data)`
-
-Parses the generated code and checks for formatting errors.
-
-**Parameters:**
-- `code_data` (_dict_): Data containing the generated code. `key - generated_code`, `val - {Python code string}`
-
-**Returns:**
-- Tuple containing parsed code and any error message.
-
-#### `execute_code(self, code)`
-
-Executes the parsed code and captures the output or error.
-
-**Parameters:**
-- `code` (_str_): Code to be executed.
-
-**Returns:**
-- Tuple containing the code, its output, and any error message.
-
-#### `forward(self, **kwargs)`
-
-Main method to execute the code generation and refinement process.
-
-**Parameters:**
-- `**kwargs`: Keyword arguments corresponding to input fields.
-
-**Returns:**
-- The final answer generated by the program or `None` in case of persistent errors.
-
-### Examples
-
-```python
-#Define a simple signature for basic question answering
-class GenerateAnswer(dspy.Signature):
- """Answer questions with short factoid answers."""
- question = dspy.InputField()
- answer = dspy.OutputField(desc="often between 1 and 5 words")
-
-# Pass signature to ProgramOfThought Module
-pot = dspy.ProgramOfThought(GenerateAnswer)
-
-#Call the ProgramOfThought module on a particular input
-question = 'Sarah has 5 apples. She buys 7 more apples from the store. How many apples does Sarah have now?'
-result = pot(question=question)
-
-print(f"Question: {question}")
-print(f"Final Predicted Answer (after ProgramOfThought process): {result.answer}")
-```
diff --git a/docs/api/modules/ReAct.md b/docs/api/modules/ReAct.md
deleted file mode 100644
index 0e40fee2e..000000000
--- a/docs/api/modules/ReAct.md
+++ /dev/null
@@ -1,81 +0,0 @@
-# dspy.ReAct
-
-### Constructor
-
-The constructor initializes the `ReAct` class and sets up its attributes. It is specifically designed to compose the interleaved steps of Thought, Action, and Observation.
-
-
-
-```python
-import dsp
-import dspy
-from ..primitives.program import Module
-from .predict import Predict
-
-class ReAct(Module):
- def __init__(self, signature, max_iters=5, num_results=3, tools=None):
- ...
-```
-
-**Parameters:**
-- `signature` (_Any_): Signature of the predictive model.
-- `max_iters` (_int_, _optional_): Maximum number of iterations for the Thought-Action-Observation cycle. Defaults to `5`.
-- `num_results` (_int_, _optional_): Number of results to retrieve in the action step. Defaults to `3`.
-- `tools` (_List[dspy.Tool]_, _optional_): List of tools available for actions. If none is provided, a default `Retrieve` tool with `num_results` is used.
-
-### Methods
-
-#### `_generate_signature(self, iters)`
-
-Generates a signature for the Thought-Action-Observation cycle based on the number of iterations.
-
-**Parameters:**
-- `iters` (_int_): Number of iterations.
-
-**Returns:**
-- A dictionary representation of the signature.
-
-***
-
-#### `act(self, output, hop)`
-
-Processes an action and returns the observation or final answer.
-
-**Parameters:**
-- `output` (_dict_): Current output from the Thought.
-- `hop` (_int_): Current iteration number.
-
-**Returns:**
-- A string representing the final answer or `None`.
-
-***
-
-#### `forward(self, **kwargs)`
-
-Main method to execute the Thought-Action-Observation cycle for a given set of input fields.
-
-**Parameters:**
-- `**kwargs`: Keyword arguments corresponding to input fields.
-
-**Returns:**
-- A `dspy.Prediction` object containing the result of the ReAct process.
-
-### Examples
-
-```python
-# Define a simple signature for basic question answering
-class BasicQA(dspy.Signature):
- """Answer questions with short factoid answers."""
- question = dspy.InputField()
- answer = dspy.OutputField(desc="often between 1 and 5 words")
-
-# Pass signature to ReAct module
-react_module = dspy.ReAct(BasicQA)
-
-# Call the ReAct module on a particular input
-question = 'What is the color of the sky?'
-result = react_module(question=question)
-
-print(f"Question: {question}")
-print(f"Final Predicted Answer (after ReAct process): {result.answer}")
-```
\ No newline at end of file
diff --git a/docs/api/modules/Retrieve.md b/docs/api/modules/Retrieve.md
deleted file mode 100644
index a17246c38..000000000
--- a/docs/api/modules/Retrieve.md
+++ /dev/null
@@ -1,43 +0,0 @@
-# dspy.Retrieve
-
-### Constructor
-
-The constructor initializes the `Retrieve` class and sets up its attributes, taking in `k` number of retrieval passages to return for a query.
-
-```python
-class Retrieve(Parameter):
- def __init__(self, k=3):
- self.stage = random.randbytes(8).hex()
- self.k = k
-```
-
-**Parameters:**
-- `k` (_Any_): Number of retrieval responses
-
-### Method
-
-#### `__call__(self, *args, **kwargs):`
-
-This method serves as a wrapper for the `forward` method. It allows making retrievals on an input query using the `Retrieve` class.
-
-**Parameters:**
-- `**args`: Arguments required for retrieval.
-- `**kwargs`: Keyword arguments required for retrieval.
-
-**Returns:**
-- The result of the `forward` method.
-
-### Examples
-
-```python
-query='When was the first FIFA World Cup held?'
-
-# Call the retriever on a particular query.
-retrieve = dspy.Retrieve(k=3)
-topK_passages = retrieve(query).passages
-
-print(f"Top {retrieve.k} passages for question: {query} \n", '-' * 30, '\n')
-
-for idx, passage in enumerate(topK_passages):
- print(f'{idx+1}]', passage, '\n')
-```
diff --git a/docs/api/modules/_category_.json b/docs/api/modules/_category_.json
deleted file mode 100644
index 5cf44ce64..000000000
--- a/docs/api/modules/_category_.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "label": "Modules",
- "position": 1,
- "link": {
- "type": "generated-index",
- "description": "Modules in DSPy"
- }
-}
\ No newline at end of file
diff --git a/docs/api/optimizers/BootstrapFewShot.md b/docs/api/optimizers/BootstrapFewShot.md
deleted file mode 100644
index 909cfc412..000000000
--- a/docs/api/optimizers/BootstrapFewShot.md
+++ /dev/null
@@ -1,64 +0,0 @@
----
-sidebar_position: 2
----
-
-# teleprompt.BootstrapFewShot
-
-### Constructor
-
-The constructor initializes the `BootstrapFewShot` class and sets up parameters for bootstrapping.
-
-```python
-class BootstrapFewShot(Teleprompter):
- def __init__(self, metric=None, metric_threshold=None, teacher_settings={}, max_bootstrapped_demos=4, max_labeled_demos=16, max_rounds=1, max_errors=5):
- self.metric = metric
- self.teacher_settings = teacher_settings
-
- self.max_bootstrapped_demos = max_bootstrapped_demos
- self.max_labeled_demos = max_labeled_demos
- self.max_rounds = max_rounds
-```
-
-**Parameters:**
-- `metric` (_callable_, _optional_): Metric function to evaluate examples during bootstrapping. Defaults to `None`.
-- `metric_threshold` (_float_, _optional_): Score threshold for metric to determine successful example. Defaults to `None`.
-- `teacher_settings` (_dict_, _optional_): Settings for teacher predictor. Defaults to empty dictionary.
-- `max_bootstrapped_demos` (_int_, _optional_): Maximum number of bootstrapped demonstrations per predictor. Defaults to 4.
-- `max_labeled_demos` (_int_, _optional_): Maximum number of labeled demonstrations per predictor. Defaults to 16.
-- `max_rounds` (_int_, _optional_): Maximum number of bootstrapping rounds. Defaults to 1.
-- `max_errors` (_int_): Maximum errors permitted during evaluation. Halts run with the latest error message. Defaults to 5. Configure to 1 if no evaluation run error is desired.
-
-### Method
-
-#### `compile(self, student, *, teacher=None, trainset)`
-
-This method compiles the BootstrapFewShot instance by performing bootstrapping to refine the student predictor.
-
-This process includes preparing the student and teacher predictors, which involves creating predictor copies, verifying the student predictor is uncompiled, and compiling the teacher predictor with labeled demonstrations via LabeledFewShot if the teacher predictor hasn't been compiled.
-
-The next stage involves preparing predictor mappings by validating that both the student and teacher predictors have the same program structure and the same signatures but are different objects.
-
-The final stage is performing the bootstrapping iterations.
-
-**Parameters:**
-- `student` (_Teleprompter_): Student predictor to be compiled.
-- `teacher` (_Teleprompter_, _optional_): Teacher predictor used for bootstrapping. Defaults to `None`.
-- `trainset` (_list_): Training dataset used in bootstrapping.
-
-**Returns:**
-- The compiled `student` predictor after bootstrapping with refined demonstrations.
-
-### Example
-
-```python
-#Assume defined trainset
-#Assume defined RAG class
-...
-
-#Define teleprompter and include teacher
-teacher = dspy.OpenAI(model='gpt-3.5-turbo', api_key = openai.api_key, api_provider = "openai", model_type = "chat")
-teleprompter = BootstrapFewShot(teacher_settings=dict({'lm': teacher}))
-
-# Compile!
-compiled_rag = teleprompter.compile(student=RAG(), trainset=trainset)
-```
diff --git a/docs/api/optimizers/BootstrapFewShotWithRandomSearch.md b/docs/api/optimizers/BootstrapFewShotWithRandomSearch.md
deleted file mode 100644
index 7b5897465..000000000
--- a/docs/api/optimizers/BootstrapFewShotWithRandomSearch.md
+++ /dev/null
@@ -1,63 +0,0 @@
----
-sidebar_position: 4
----
-
-# teleprompt.BootstrapFewShotWithRandomSearch
-
-### Constructor
-
-The constructor initializes the `BootstrapFewShotWithRandomSearch` class and sets up its attributes. It inherits from the `BootstrapFewShot` class and introduces additional attributes for the random search process.
-
-```python
-class BootstrapFewShotWithRandomSearch(BootstrapFewShot):
- def __init__(self, metric, teacher_settings={}, max_bootstrapped_demos=4, max_labeled_demos=16, max_rounds=1, num_candidate_programs=16, num_threads=6, max_errors=10, stop_at_score=None, metric_threshold=None):
- self.metric = metric
- self.teacher_settings = teacher_settings
- self.max_rounds = max_rounds
- self.num_threads = num_threads
- self.stop_at_score = stop_at_score
- self.metric_threshold = metric_threshold
- self.min_num_samples = 1
- self.max_num_samples = max_bootstrapped_demos
- self.max_errors = max_errors
- self.num_candidate_sets = num_candidate_programs
- self.max_num_traces = 1 + int(max_bootstrapped_demos / 2.0 * self.num_candidate_sets)
-
- self.max_bootstrapped_demos = self.max_num_traces
- self.max_labeled_demos = max_labeled_demos
-
- print("Going to sample between", self.min_num_samples, "and", self.max_num_samples, "traces per predictor.")
- print("Going to sample", self.max_num_traces, "traces in total.")
- print("Will attempt to train", self.num_candidate_sets, "candidate sets.")
-```
-
-**Parameters:**
-- `metric` (_callable_, _optional_): Metric function to evaluate examples during bootstrapping. Defaults to `None`.
-- `teacher_settings` (_dict_, _optional_): Settings for teacher predictor. Defaults to an empty dictionary.
-- `max_bootstrapped_demos` (_int_, _optional_): Maximum number of bootstrapped demonstrations per predictor. Defaults to 4.
-- `max_labeled_demos` (_int_, _optional_): Maximum number of labeled demonstrations per predictor. Defaults to 16.
-- `max_rounds` (_int_, _optional_): Maximum number of bootstrapping rounds. Defaults to 1.
-- `num_candidate_programs` (_int_): Number of candidate programs to generate during random search. Defaults to 16.
-- `num_threads` (_int_): Number of threads used for evaluation during random search. Defaults to 6.
-- `max_errors` (_int_): Maximum errors permitted during evaluation. Halts run with the latest error message. Defaults to 10. Configure to 1 if no evaluation run error is desired.
-- `stop_at_score` (_float_, _optional_): Score threshold for random search to stop early. Defaults to `None`.
-- `metric_threshold` (_float_, _optional_): Score threshold for metric to determine successful example. Defaults to `None`.
-
-### Method
-
-Refer to [teleprompt.BootstrapFewShot](https://dspy-docs.vercel.app/docs/deep-dive/teleprompter/bootstrap-fewshot) documentation.
-
-## Example
-
-```python
-#Assume defined trainset
-#Assume defined RAG class
-...
-
-#Define teleprompter and include teacher
-teacher = dspy.OpenAI(model='gpt-3.5-turbo', api_key = openai.api_key, api_provider = "openai", model_type = "chat")
-teleprompter = BootstrapFewShotWithRandomSearch(teacher_settings=dict({'lm': teacher}))
-
-# Compile!
-compiled_rag = teleprompter.compile(student=RAG(), trainset=trainset)
-```
diff --git a/docs/api/optimizers/_category_.json b/docs/api/optimizers/_category_.json
deleted file mode 100644
index 8f98c5b3b..000000000
--- a/docs/api/optimizers/_category_.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "label": "Optimizers",
- "position": 3,
- "link": {
- "type": "generated-index",
- "description": "Teleprompters are powerful optimizers (included in DSPy) that can learn to bootstrap and select effective prompts for the modules of any program. (The \"tele-\" in the name means \"at a distance\", i.e., automatic prompting at a distance.)\n\nThis documentation provides an overview of the DSPy Teleprompters."
- }
-}
\ No newline at end of file
diff --git a/docs/api/retrieval_model_clients/AzureCognitiveSearch.md b/docs/api/retrieval_model_clients/AzureCognitiveSearch.md
deleted file mode 100644
index bb210e830..000000000
--- a/docs/api/retrieval_model_clients/AzureCognitiveSearch.md
+++ /dev/null
@@ -1,39 +0,0 @@
----
-sidebar_position: 3
----
-
-# retrieve.AzureCognitiveSearch
-
-### Constructor
-
-The constructor initializes an instance of the `AzureCognitiveSearch` class and sets up parameters for sending queries and retreiving results with the Azure Cognitive Search server.
-
-```python
-class AzureCognitiveSearch:
- def __init__(
- self,
- search_service_name: str,
- search_api_key: str,
- search_index_name: str,
- field_text: str,
- field_score: str, # required field to map with "score" field in dsp framework
- ):
-```
-
-**Parameters:**
-
-- `search_service_name` (_str_): Name of Azure Cognitive Search server.
-- `search_api_key` (_str_): API Authentication token for accessing Azure Cognitive Search server.
-- `search_index_name` (_str_): Name of search index in the Azure Cognitive Search server.
-- `field_text` (_str_): Field name that maps to DSP "content" field.
-- `field_score` (_str_): Field name that maps to DSP "score" field.
-
-### Methods
-
-Refer to [ColBERTv2](/api/retrieval_model_clients/ColBERTv2) documentation. Keep in mind there is no `simplify` flag for AzureCognitiveSearch.
-
-AzureCognitiveSearch supports sending queries and processing the received results, mapping content and scores to a correct format for the Azure Cognitive Search server.
-
-### Deprecation Notice
-
-This module is scheduled for removal in future releases. Please use the AzureAISearchRM class from dspy.retrieve.azureaisearch_rm instead.For more information, refer to the updated documentation(docs/docs/deep-dive/retrieval_models_clients/Azure.mdx).
diff --git a/docs/api/retrieval_model_clients/ChromadbRM.md b/docs/api/retrieval_model_clients/ChromadbRM.md
deleted file mode 100644
index 97fbe26d4..000000000
--- a/docs/api/retrieval_model_clients/ChromadbRM.md
+++ /dev/null
@@ -1,68 +0,0 @@
----
-sidebar_position: 4
----
-
-# retrieve.ChromadbRM
-
-### Constructor
-
-Initialize an instance of the `ChromadbRM` class, with the option to use OpenAI's embeddings or any alternative supported by chromadb, as detailed in the official [chromadb embeddings documentation](https://docs.trychroma.com/embeddings).
-
-```python
-ChromadbRM(
- collection_name: str,
- persist_directory: str,
- embedding_function: Optional[EmbeddingFunction[Embeddable]] = OpenAIEmbeddingFunction(),
- k: int = 7,
-)
-```
-
-**Parameters:**
-
-- `collection_name` (_str_): The name of the chromadb collection.
-- `persist_directory` (_str_): Path to the directory where chromadb data is persisted.
-- `embedding_function` (_Optional[EmbeddingFunction[Embeddable]]_, _optional_): The function used for embedding documents and queries. Defaults to `DefaultEmbeddingFunction()` if not specified.
-- `k` (_int_, _optional_): The number of top passages to retrieve. Defaults to 7.
-
-### Methods
-
-#### `forward(self, query_or_queries: Union[str, List[str]], k: Optional[int] = None) -> dspy.Prediction`
-
-Search the chromadb collection for the top `k` passages matching the given query or queries, using embeddings generated via the specified `embedding_function`.
-
-**Parameters:**
-
-- `query_or_queries` (_Union[str, List[str]]_): The query or list of queries to search for.
-- `k` (_Optional[int]_, _optional_): The number of results to retrieve. If not specified, defaults to the value set during initialization.
-
-**Returns:**
-
-- `dspy.Prediction`: Contains the retrieved passages, each represented as a `dotdict` with schema `[{"id": str, "score": float, "long_text": str, "metadatas": dict }]`
-
-### Quickstart with OpenAI Embeddings
-
-ChromadbRM have the flexibility from a variety of embedding functions as outlined in the [chromadb embeddings documentation](https://docs.trychroma.com/embeddings). While different options are available, this example demonstrates how to utilize OpenAI embeddings specifically.
-
-```python
-from dspy.retrieve.chromadb_rm import ChromadbRM
-import os
-import openai
-from chromadb.utils.embedding_functions import OpenAIEmbeddingFunction
-
-embedding_function = OpenAIEmbeddingFunction(
- api_key=os.environ.get('OPENAI_API_KEY'),
- model_name="text-embedding-ada-002"
-)
-
-retriever_model = ChromadbRM(
- 'your_collection_name',
- '/path/to/your/db',
- embedding_function=embedding_function,
- k=5
-)
-
-results = retriever_model("Explore the significance of quantum computing", k=5)
-
-for result in results:
- print("Document:", result.long_text, "\n")
-```
diff --git a/docs/api/retrieval_model_clients/ColBERTv2.md b/docs/api/retrieval_model_clients/ColBERTv2.md
deleted file mode 100644
index a8fea9492..000000000
--- a/docs/api/retrieval_model_clients/ColBERTv2.md
+++ /dev/null
@@ -1,129 +0,0 @@
----
-sidebar_position: 1
----
-
-# dspy.ColBERTv2
-
-### Constructor
-
-The constructor initializes the `ColBERTv2` class instance and sets up the request parameters for interacting with the ColBERTv2 server.
-
-```python
-class ColBERTv2:
- def __init__(
- self,
- url: str = "http://0.0.0.0",
- port: Optional[Union[str, int]] = None,
- post_requests: bool = False,
- ):
-```
-
-**Parameters:**
-- `url` (_str_): URL for ColBERTv2 server.
-- `port` (_Union[str, int]_, _Optional_): Port endpoint for ColBERTv2 server. Defaults to `None`.
-- `post_requests` (_bool_, _Optional_): Flag for using HTTP POST requests. Defaults to `False`.
-
-### Methods
-
-#### `__call__(self, query: str, k: int = 10, simplify: bool = False) -> Union[list[str], list[dotdict]]`
-
-Enables making queries to the ColBERTv2 server for retrieval. Internally, the method handles the specifics of preparing the request prompt and corresponding payload to obtain the response. The function handles the retrieval of the top-k passages based on the provided query.
-
-**Parameters:**
-- `query` (_str_): Query string used for retrieval.
-- `k` (_int_, _optional_): Number of passages to retrieve. Defaults to 10.
-- `simplify` (_bool_, _optional_): Flag for simplifying output to a list of strings. Defaults to False.
-
-**Returns:**
-- `Union[list[str], list[dotdict]]`: Depending on `simplify` flag, either a list of strings representing the passage content (`True`) or a list of `dotdict` instances containing passage details (`False`).
-
-### Quickstart
-
-```python
-import dspy
-
-colbertv2_wiki17_abstracts = dspy.ColBERTv2(url='http://20.102.90.50:2017/wiki17_abstracts')
-
-retrieval_response = colbertv2_wiki17_abstracts('When was the first FIFA World Cup held?', k=5)
-
-for result in retrieval_response:
- print("Text:", result['text'], "\n")
-```
-
-# dspy.ColBERTv2RetrieverLocal
-
-This is taken from the official documentation of [Colbertv2](https://github.com/stanford-futuredata/ColBERT/tree/main) following the [paper](https://arxiv.org/abs/2112.01488).
-
-You can install Colbertv2 by the following instructions from [here](https://github.com/stanford-futuredata/ColBERT?tab=readme-ov-file#installation)
-
-### Constructor
-The constructor initializes the ColBERTv2 as a local retriever object. You can initialize a server instance from your ColBERTv2 local instance using the code snippet from [here](https://github.com/stanford-futuredata/ColBERT/blob/main/server.py)
-
-```python
-class ColBERTv2RetrieverLocal:
- def __init__(
- self,
- passages:List[str],
- colbert_config=None,
- load_only:bool=False):
-```
-
-**Parameters**
-- `passages` (_List[str]_): List of passages to be indexed
-- `colbert_config` (_ColBERTConfig_, _Optional_): colbert config for building and searching. Defaults to None.
-- `load_only` (_Boolean_): whether to load the index or build and then load. Defaults to False.
-
-The `colbert_config` object is required for ColBERTv2, and it can be imported from `from colbert.infra.config import ColBERTConfig`. You can find the descriptions of config attributes from [here](https://github.com/stanford-futuredata/ColBERT/blob/main/colbert/infra/config/settings.py)
-
-### Methods
-
-#### `forward(self, query:str, k:int, **kwargs) -> Union[list[str], list[dotdict]]`
-
-It retrieves relevant passages from the index based on the query. If you already have a local index, then you can pass the `load_only` flag as `True` and change the `index` attribute of ColBERTConfig to the local path. Also, make sure to change the `checkpoint` attribute of ColBERTConfig to the embedding model that you used to build the index.
-
-**Parameters:**
-- `query` (_str_): Query string used for retrieval.
-- `k` (_int_, _optional_): Number of passages to retrieve. Defaults to 7
-
-It returns a `Prediction` object for each query
-
-```python
-Prediction(
- pid=[33, 6, 47, 74, 48],
- passages=['No pain, no gain.', 'The best things in life are free.', 'Out of sight, out of mind.', 'To be or not to be, that is the question.', 'Patience is a virtue.']
-)
-```
-# dspy.ColBERTv2RerankerLocal
-
-You can also use ColBERTv2 as a reranker in DSPy.
-
-### Constructor
-
-```python
-class ColBERTv2RerankerLocal:
-
- def __init__(
- self,
- colbert_config=None,
- checkpoint:str='bert-base-uncased'):
-```
-
-**Parameters**
-- `colbert_config` (_ColBERTConfig_, _Optional_): colbert config for building and searching. Defaults to None.
-- `checkpoint` (_str_): Embedding model for embeddings the documents and query
-
-### Methods
-#### `forward(self,query:str,passages:List[str])`
-
-Based on a query and list of passages, it reranks the passages and returns the scores along with the passages ordered in descending order based on the similarity scores.
-
-**Parameters:**
-- `query` (_str_): Query string used for reranking.
-- `passages` (_List[str]_): List of passages to be reranked
-
-It returns the similarity scores array and you can link it to the passages by
-
-```python
-for idx in np.argsort(scores_arr)[::-1]:
- print(f"Passage = {passages[idx]} --> Score = {scores_arr[idx]}")
-```
\ No newline at end of file
diff --git a/docs/api/retrieval_model_clients/MilvusRM.md b/docs/api/retrieval_model_clients/MilvusRM.md
deleted file mode 100644
index 2f10b77c5..000000000
--- a/docs/api/retrieval_model_clients/MilvusRM.md
+++ /dev/null
@@ -1,100 +0,0 @@
----
-sidebar_position: 6
----
-
-# retrieve.MilvusRM
-
-### Constructor
-
-Initialize an instance of the `MilvusRM` class, with the option to use OpenAI's `text-embedding-3-small` embeddings or any customized embedding function.
-
-```python
-MilvusRM(
- collection_name: str,
- uri: Optional[str] = "http://localhost:19530",
- token: Optional[str] = None,
- db_name: Optional[str] = "default",
- embedding_function: Optional[Callable] = None,
- k: int = 3,
-)
-```
-
-**Parameters:**
-
-- `collection_name (str)`: The name of the Milvus collection to query against.
-- `uri (str, optional)`: The Milvus connection uri. Defaults to "http://localhost:19530".
-- `token (str, optional)`: The Milvus connection token. Defaults to None.
-- `db_name (str, optional)`: The Milvus database name. Defaults to "default".
-- `embedding_function (callable, optional)`: The function to convert a list of text to embeddings.
- The embedding function should take a list of text strings as input and output a list of embeddings.
- Defaults to None. By default, it will get OpenAI client by the environment variable OPENAI_API_KEY and use OpenAI's embedding model "text-embedding-3-small" with the default dimension.
-- `k (int, optional)`: The number of top passages to retrieve. Defaults to 3.
-
-### Methods
-
-#### `forward(self, query_or_queries: Union[str, List[str]], k: Optional[int] = None) -> dspy.Prediction`
-
-Search the Milvus collection for the top `k` passages matching the given query or queries, using embeddings generated via the default OpenAI embedding or the specified `embedding_function`.
-
-**Parameters:**
-
-- `query_or_queries` (_Union[str, List[str]]_): The query or list of queries to search for.
-- `k` (_Optional[int]_, _optional_): The number of results to retrieve. If not specified, defaults to the value set during initialization.
-
-**Returns:**
-
-- `dspy.Prediction`: Contains the retrieved passages, each represented as a `dotdict` with schema `[{"id": str, "score": float, "long_text": str, "metadatas": dict }]`
-
-### Quickstart
-
-To support passage retrieval, it assumes that a Milvus collection has been created and populated with the following field:
-
-- `text`: The text of the passage
-
-MilvusRM uses OpenAI's `text-embedding-3-small` embedding by default or any customized embedding function.
-While different options are available, the examples below demonstrate how to utilize the default OpenAI embeddings and a customized embedding function using the BGE model.
-
-#### Default OpenAI Embeddings
-
-```python
-from dspy.retrieve.milvus_rm import MilvusRM
-import os
-
-os.envrion["OPENAI_API_KEY"] = "<YOUR_OPENAI_API_KEY>"
-
-retriever_model = MilvusRM(
- collection_name="<YOUR_COLLECTION_NAME>",
- uri="<YOUR_MILVUS_URI>",
- token="<YOUR_MILVUS_TOKEN>" # ignore this if no token is required for Milvus connection
- )
-
-results = retriever_model("Explore the significance of quantum computing", k=5)
-
-for result in results:
- print("Document:", result.long_text, "\n")
-```
-
-#### Customized Embedding Function
-
-```python
-from dspy.retrieve.milvus_rm import MilvusRM
-from sentence_transformers import SentenceTransformer
-
-model = SentenceTransformer('BAAI/bge-base-en-v1.5')
-
-def bge_embedding_function(texts: List[str]):
- embeddings = model.encode(texts, normalize_embeddings=True)
- return embeddings
-
-retriever_model = MilvusRM(
- collection_name="<YOUR_COLLECTION_NAME>",
- uri="<YOUR_MILVUS_URI>",
- token="<YOUR_MILVUS_TOKEN>", # ignore this if no token is required for Milvus connection
- embedding_function=bge_embedding_function
- )
-
-results = retriever_model("Explore the significance of quantum computing", k=5)
-
-for result in results:
- print("Document:", result.long_text, "\n")
-```
diff --git a/docs/api/retrieval_model_clients/_category_.json b/docs/api/retrieval_model_clients/_category_.json
deleted file mode 100644
index 964dab01b..000000000
--- a/docs/api/retrieval_model_clients/_category_.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "label": "Retrieval Model Clients",
- "position": 4,
- "link": {
- "type": "generated-index",
- "description": "This documentation provides an overview of the DSPy Retrieval Model Clients."
- }
-}
\ No newline at end of file
diff --git a/docs/api/assertions.md b/docs/docs/deep-dive/assertions.md
similarity index 100%
rename from docs/api/assertions.md
rename to docs/docs/deep-dive/assertions.md
diff --git a/docs/api/modules/ChainOfThought.md b/docs/docs/deep-dive/modules/ChainOfThought.md
similarity index 100%
rename from docs/api/modules/ChainOfThought.md
rename to docs/docs/deep-dive/modules/ChainOfThought.md
diff --git a/docs/api/modules/MultiChainComparison.md b/docs/docs/deep-dive/modules/MultiChainComparison.md
similarity index 100%
rename from docs/api/modules/MultiChainComparison.md
rename to docs/docs/deep-dive/modules/MultiChainComparison.md
diff --git a/docs/api/modules/Predict.md b/docs/docs/deep-dive/modules/Predict.md
similarity index 100%
rename from docs/api/modules/Predict.md
rename to docs/docs/deep-dive/modules/Predict.md
diff --git a/docs/api/optimizers/BootstrapFinetune.md b/docs/docs/deep-dive/optimizers/BootstrapFinetune.md
similarity index 100%
rename from docs/api/optimizers/BootstrapFinetune.md
rename to docs/docs/deep-dive/optimizers/BootstrapFinetune.md
diff --git a/docs/api/optimizers/Ensemble.md b/docs/docs/deep-dive/optimizers/Ensemble.md
similarity index 100%
rename from docs/api/optimizers/Ensemble.md
rename to docs/docs/deep-dive/optimizers/Ensemble.md
diff --git a/docs/api/optimizers/LabeledFewShot.md b/docs/docs/deep-dive/optimizers/LabeledFewShot.md
similarity index 100%
rename from docs/api/optimizers/LabeledFewShot.md
rename to docs/docs/deep-dive/optimizers/LabeledFewShot.md
diff --git a/docs/docs/deep-dive/optimizers/bfrs.mdx b/docs/docs/deep-dive/optimizers/bfrs.mdx
new file mode 100644
index 000000000..214d588ac
--- /dev/null
+++ b/docs/docs/deep-dive/optimizers/bfrs.mdx
@@ -0,0 +1,28 @@
+---
+sidebar_position: 4
+---
+
+# teleprompt.BootstrapFewShotWithRandomSearch
+
+### Constructor
+
+The constructor initializes the `BootstrapFewShotWithRandomSearch` class and sets up its attributes. It inherits from the `BootstrapFewShot` class and introduces additional attributes for the random search process.
+
+### Method
+
+Refer to [teleprompt.BootstrapFewShot](https://dspy-docs.vercel.app/docs/deep-dive/teleprompter/bootstrap-fewshot) documentation.
+
+## Example
+
+```python
+#Assume defined trainset
+#Assume defined RAG class
+...
+
+#Define teleprompter and include teacher
+teacher = dspy.OpenAI(model='gpt-3.5-turbo', api_key = openai.api_key, api_provider = "openai", model_type = "chat")
+teleprompter = BootstrapFewShotWithRandomSearch(teacher_settings=dict({'lm': teacher}))
+
+# Compile!
+compiled_rag = teleprompter.compile(student=RAG(), trainset=trainset)
+```
\ No newline at end of file
diff --git a/docs/api/retrieval_model_clients/DatabricksRM.md b/docs/docs/deep-dive/retrieval_models_clients/DatabricksRM.md
similarity index 100%
rename from docs/api/retrieval_model_clients/DatabricksRM.md
rename to docs/docs/deep-dive/retrieval_models_clients/DatabricksRM.md
diff --git a/docs/api/retrieval_model_clients/FaissRM.md b/docs/docs/deep-dive/retrieval_models_clients/FaissRM.md
similarity index 100%
rename from docs/api/retrieval_model_clients/FaissRM.md
rename to docs/docs/deep-dive/retrieval_models_clients/FaissRM.md
diff --git a/docs/api/retrieval_model_clients/MyScaleRM.md b/docs/docs/deep-dive/retrieval_models_clients/MyScaleRM.md
similarity index 100%
rename from docs/api/retrieval_model_clients/MyScaleRM.md
rename to docs/docs/deep-dive/retrieval_models_clients/MyScaleRM.md
diff --git a/docs/api/retrieval_model_clients/Neo4jRM.md b/docs/docs/deep-dive/retrieval_models_clients/Neo4jRM.md
similarity index 100%
rename from docs/api/retrieval_model_clients/Neo4jRM.md
rename to docs/docs/deep-dive/retrieval_models_clients/Neo4jRM.md
diff --git a/docs/api/retrieval_model_clients/RAGatouilleRM.md b/docs/docs/deep-dive/retrieval_models_clients/RAGatouilleRM.md
similarity index 100%
rename from docs/api/retrieval_model_clients/RAGatouilleRM.md
rename to docs/docs/deep-dive/retrieval_models_clients/RAGatouilleRM.md
diff --git a/docs/api/retrieval_model_clients/SnowflakeRM.md b/docs/docs/deep-dive/retrieval_models_clients/SnowflakeRM.md
similarity index 100%
rename from docs/api/retrieval_model_clients/SnowflakeRM.md
rename to docs/docs/deep-dive/retrieval_models_clients/SnowflakeRM.md
diff --git a/docs/api/retrieval_model_clients/WatsonDiscovery.md b/docs/docs/deep-dive/retrieval_models_clients/WatsonDiscovery.md
similarity index 100%
rename from docs/api/retrieval_model_clients/WatsonDiscovery.md
rename to docs/docs/deep-dive/retrieval_models_clients/WatsonDiscovery.md
diff --git a/docs/api/retrieval_model_clients/YouRM.md b/docs/docs/deep-dive/retrieval_models_clients/YouRM.md
similarity index 100%
rename from docs/api/retrieval_model_clients/YouRM.md
rename to docs/docs/deep-dive/retrieval_models_clients/YouRM.md