-
Notifications
You must be signed in to change notification settings - Fork 105
Add Portkey Observability Documentation #174
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
Open
siddharthsambharia-portkey
wants to merge
6
commits into
mistralai:main
Choose a base branch
from
siddharthsambharia-portkey:portkey-integration-docs
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
9c98cb2
portkey docs observability
3998267
portkey docs observability v2
aed4e10
update mistral cookbook
ec4971f
quick fix
0614699
resolve merge conflicts
4c7f4a6
Merge branch 'main' into portkey-integration-docs
siddharthsambharia-portkey File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -142,6 +142,68 @@ Here is a step-by-step [example](https://github.com/mistralai/cookbook/blob/main | |
| <img src="/img/guides/obs_langfuse2.png" alt="drawing" width="700"/> | ||
|
|
||
|
|
||
|
|
||
| Here's the PortkeyAI observability section in the same style as the Mistral docs: | ||
|
|
||
|
|
||
| ### Integration with PortkeyAI | ||
|
||
|
|
||
| PortkeyAI is an open-source AI gateway that provides unified observability across all your Mistral AI requests. It offers real-time analytics, detailed logs, tracing, and metadata tracking through a single API layer. | ||
|
|
||
| <img src="https://raw.githubusercontent.com/siddharthsambharia-portkey/Portkey-Product-Images/refs/heads/main/Portkey-Dashboard.png" alt="Portkey Analytics Dashboard" width="700"/> | ||
|
|
||
| **Pros:** | ||
|
|
||
| * **Open-source AI Gateway** - Self-host or use cloud-managed version | ||
| * **Unified API** - OpenAI compliant API that works with Mistral models | ||
| * **Real-time Analytics** - Track cost, latency, token usage across all models | ||
| * **Metadata Filtering** - Add custom metadata and filter logs by any parameter | ||
| * **Request Tracing** - Visualize complete request lifecycle and LLM call chains | ||
| * **Feedback API** - Programmatically collect user feedback on generations | ||
|
|
||
| **Key Observability Features:** | ||
|
|
||
| 1. **Cost Tracking** - Real-time spend tracking across models/providers | ||
| 2. **Latency Monitoring** - P95/P99 latency metrics with error budgets | ||
| 3. **Token Analytics** - Input/output token tracking with cost estimates | ||
| 4. **Custom Metadata** - Add business context (user IDs, session IDs, etc) | ||
| 5. **Semantic Search** - Search across all LLM request/responses | ||
| 6. **Tracing** - Visualize complex workflows and multi-LLM call chains | ||
|
|
||
| **Mistral Integration Example:** | ||
| ```bash | ||
| !pip install portkey-ai | ||
| ``` | ||
| ```python | ||
| from portkey_ai import Portkey | ||
|
|
||
| portkey = Portkey( | ||
| api_key="PORTKEY_API_KEY", | ||
| virtual_key="MISTRAL_VIRTUAL_KEY", | ||
| metadata={"environment": "production", "user_id": "123"} | ||
| ) | ||
|
|
||
| # Track metadata and trace ID for observability | ||
| response = portkey.with_options( | ||
| metadata = { | ||
| "_user": "USER_ID", | ||
| "environment": "production", | ||
| "prompt": "test_prompt", | ||
| "session_id": "1729" | ||
| }).chat.completions.create( | ||
| messages = [{ "role": 'user', "content": 'What is 1729' }], | ||
| model = 'your-mistral-model' | ||
| ) | ||
|
|
||
| print(response.choices[0].message) | ||
| ``` | ||
|
|
||
| **Getting Started:** | ||
siddharthsambharia-portkey marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| - [Mistral Integration Guide on Portkey Docs](https://portkey.sh/mistral) | ||
| - [Open-source Gateway GitHub](https://github.com/Portkey-AI/gateway) | ||
|
|
||
|
|
||
|
|
||
| ### Integration with Arize Phoenix | ||
|
|
||
| Phoenix is an open-source observability library designed for experimentation, evaluation, and troubleshooting. It is designed to support agents, RAG pipelines, and other LLM applications. | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.