Skip to content

Commit

Permalink
Doc Updates (mem0ai#1843)
Browse files Browse the repository at this point in the history
  • Loading branch information
prateekchhikara authored Sep 10, 2024
1 parent bbddb98 commit 5b9b65c
Show file tree
Hide file tree
Showing 4 changed files with 301 additions and 31 deletions.
31 changes: 30 additions & 1 deletion docs/components/llms/models/azure_openai.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,35 @@ m = Memory.from_config(config)
m.add("Likes to play cricket on weekends", user_id="alice", metadata={"category": "hobbies"})
```

We also support the new [OpenAI structured-outputs](https://platform.openai.com/docs/guides/structured-outputs/introduction) model.

```python
import os
from mem0 import Memory

os.environ["LLM_AZURE_OPENAI_API_KEY"] = "your-api-key"
os.environ["LLM_AZURE_DEPLOYMENT"] = "your-deployment-name"
os.environ["LLM_AZURE_ENDPOINT"] = "your-api-base-url"
os.environ["LLM_AZURE_API_VERSION"] = "version-to-use"

config = {
"llm": {
"provider": "azure_openai_structured",
"config": {
"model": "your-deployment-name",
"temperature": 0.1,
"max_tokens": 2000,
"azure_kwargs" : {
"azure_deployment" : "",
"api_version" : "",
"azure_endpoint" : "",
"api_key" : ""
}
}
}
}
```

## Config

All available parameters for the `azure_openai` config are present in [Master List of All Params in Config](../config).
All available parameters for the `azure_openai` config are present in [Master List of All Params in Config](../config).
26 changes: 25 additions & 1 deletion docs/components/llms/overview.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,28 @@ To view all supported llms, visit the [Supported LLMs](./models).
<Card title="Mistral AI" href="/components/llms/models/mistral_ai"></Card>
<Card title="Google AI" href="/components/llms/models/google_ai"></Card>
<Card title="AWS bedrock" href="/components/llms/models/aws_bedrock"></Card>
</CardGroup>
</CardGroup>

## Structured vs Unstructured Outputs

Mem0 supports two types of OpenAI LLM formats, each with its own strengths and use cases:

### Structured Outputs

Structured outputs are LLMs that align with OpenAI's structured outputs model:

- **Optimized for:** Returning structured responses (e.g., JSON objects)
- **Benefits:** Precise, easily parseable data
- **Ideal for:** Data extraction, form filling, API responses
- **Learn more:** [OpenAI Structured Outputs Guide](https://platform.openai.com/docs/guides/structured-outputs/introduction)

### Unstructured Outputs

Unstructured outputs correspond to OpenAI's standard, free-form text model:

- **Flexibility:** Returns open-ended, natural language responses
- **Customization:** Use the `response_format` parameter to guide output
- **Trade-off:** Less efficient than structured outputs for specific data needs
- **Best for:** Creative writing, explanations, general conversation

Choose the format that best suits your application's requirements for optimal performance and usability.
Loading

0 comments on commit 5b9b65c

Please sign in to comment.