Skip to content

Portkey open source Gateway integration with Codestral #58

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
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 on using Instruct and Fill In Middle(FIM) with LlamaIndex 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).