-
Notifications
You must be signed in to change notification settings - Fork 299
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Documentation updates * Fix typo in docs
- Loading branch information
Showing
14 changed files
with
98 additions
and
38 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
2 changes: 1 addition & 1 deletion
2
apps/opik-documentation/documentation/docs/tracing/annotate_traces.md
This file contains 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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
--- | ||
sidebar_position: 3 | ||
sidebar_position: 4 | ||
sidebar_label: Annotate Traces | ||
--- | ||
|
||
|
4 changes: 2 additions & 2 deletions
4
apps/opik-documentation/documentation/docs/tracing/integrations/_category_.json
This file contains 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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
{ | ||
"label": "Integrations", | ||
"position": 6, | ||
"position": 5, | ||
"link": { | ||
"type": "generated-index" | ||
} | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
apps/opik-documentation/documentation/docs/tracing/log_distributed_traces.md
This file contains 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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
--- | ||
sidebar_position: 2 | ||
sidebar_position: 3 | ||
sidebar_label: Log Distributed Traces | ||
--- | ||
|
||
|
70 changes: 70 additions & 0 deletions
70
apps/opik-documentation/documentation/docs/tracing/log_multimodal_traces.md
This file contains 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 |
---|---|---|
@@ -0,0 +1,70 @@ | ||
--- | ||
sidebar_position: 2 | ||
sidebar_label: Log Multimodal Traces | ||
toc_min_heading_level: 2 | ||
toc_max_heading_level: 4 | ||
--- | ||
|
||
# Log Multimodal Traces | ||
|
||
Opik supports multimodal traces allowing you to track not just the text input and output of your LLM, but also images. | ||
|
||
![Traces with OpenAI](/img/tracing/image_trace.png) | ||
|
||
## Log a trace with an image using OpenAI SDK | ||
|
||
As long as your trace input or output follows the OpenAI format, images will automatically be detected and rendered in the Opik UI. | ||
|
||
We recommend that you use the [`track_openai`](/python-sdk-reference/integrations/openai/track_openai.html) wrapper to ensure the OpenAI API call is traced correctly: | ||
|
||
```python | ||
from opik.integrations.openai import track_openai | ||
from openai import OpenAI | ||
|
||
# Create the OpenAI client and enable Opik tracing | ||
client = track_openai(OpenAI()) | ||
|
||
response = client.chat.completions.create( | ||
model="gpt-4o-mini", | ||
messages=[ | ||
{ | ||
"role": "user", | ||
"content": [ | ||
{"type": "text", "text": "What’s in this image?"}, | ||
{ | ||
"type": "image_url", | ||
"image_url": { | ||
"url": "https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg", | ||
}, | ||
}, | ||
], | ||
} | ||
], | ||
max_tokens=300, | ||
) | ||
|
||
print(response.choices[0]) | ||
``` | ||
|
||
## Manually logging images | ||
|
||
If you are not using the OpenAI SDK, you can still log images to the platform. The UI will automatically detect the image and display it if the input field has a `message` attribute that follows the OpenAI format: | ||
|
||
```json | ||
{ | ||
"messages": [ | ||
..., | ||
{ | ||
"type": "image_url", | ||
"image_url": { | ||
"url": "<url or base64 encoded image>" | ||
} | ||
} | ||
], | ||
... | ||
} | ||
``` | ||
|
||
:::tip | ||
Let's us know on [Github](https://github.com/comet-ml/opik/issues/new/choose) if you would like to us to support additional image formats or models. | ||
::: |
This file contains 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
Binary file added
BIN
+904 KB
apps/opik-documentation/documentation/static/img/tracing/image_trace.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.