Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions docs/capabilities/code-generation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -350,3 +350,28 @@ messages = [
MistralAI(api_key=api_key, model=mistral_model).chat(messages)
```
Check out more details in this [notebook](https://github.com/run-llama/llama_index/blob/main/docs/docs/examples/cookbooks/codestral.ipynb).

## Integration with Portkey
Portkey provides observability, reliability, and caching layer over Codestral Instruct. Here is how you can use it with Portkey:

```py
# make sure to install `portkey-ai` in your Python enviornment

import os
from portkey_ai import Portkey

portkey = Portkey(
api_key=os.environ["PORTKEY_API_KEY"],
provider="mistral-ai",
authorization="Bearer MISTRAL_API_KEY"
)

mistral_model = "codestral-latest"
messages=[{"role": "user", "content": "Write a function for fibonacci"}]

code_completion = portkey.chat.completions.create(
model=mistral_model,
messages=messages
)
```
Check out more details in this [doc](https://portkey.ai/docs/welcome/integration-guides/mistral-ai).