Skip to content

Commit

Permalink
Fix broken links (#682)
Browse files Browse the repository at this point in the history
  • Loading branch information
jverre authored Nov 21, 2024
1 parent 8cc60c7 commit db41555
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 21 deletions.
12 changes: 7 additions & 5 deletions apps/opik-documentation/documentation/docs/cookbook/anthropic.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,7 @@ PROMPT = "Why is it important to use a LLM Monitoring like CometML Opik tool tha
response = anthropic_client.messages.create(
model="claude-3-5-sonnet-20241022",
max_tokens=1024,
messages=[
{"role": "user", "content": PROMPT}
]
messages=[{"role": "user", "content": PROMPT}],
)
print("Response", response.content[0].text)
```
Expand Down Expand Up @@ -87,7 +85,9 @@ anthropic_client = track_anthropic(anthropic)
@track
def generate_story(prompt):
res = anthropic_client.messages.create(
model="claude-3-5-sonnet-20241022", max_tokens=1024, messages=[{"role": "user", "content": prompt}]
model="claude-3-5-sonnet-20241022",
max_tokens=1024,
messages=[{"role": "user", "content": prompt}],
)
return res.content[0].text

Expand All @@ -96,7 +96,9 @@ def generate_story(prompt):
def generate_topic():
prompt = "Generate a topic for a story about Opik."
res = anthropic_client.messages.create(
model="claude-3-5-sonnet-20241022", max_tokens=1024, messages=[{"role": "user", "content": prompt}]
model="claude-3-5-sonnet-20241022",
max_tokens=1024,
messages=[{"role": "user", "content": prompt}],
)
return res.content[0].text

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Opik provides a seamless integration with LangGraph, allowing you to easily log

## Getting Started

To use the [`OpikTracer`](/python-sdk-reference/integrations/langchain/OpikTracer.html) with LangGraph, you'll need to have both the `opik` and `langgraph` packages installed. You can install them using pip:
To use the [`OpikTracer`](https://www.comet.com/docs/opik/python-sdk-reference/integrations/langchain/OpikTracer.html) with LangGraph, you'll need to have both the `opik` and `langgraph` packages installed. You can install them using pip:

```bash
pip install opik langgraph
Expand All @@ -29,7 +29,7 @@ opik configure

## Using the OpikTracer

You can use the [`OpikTracer`](/python-sdk-reference/integrations/langchain/OpikTracer.html) callback with any LangGraph graph by passing it in as an argument to the `stream` or `invoke` functions:
You can use the [`OpikTracer`](https://www.comet.com/docs/opik/python-sdk-reference/integrations/langchain/OpikTracer.html) callback with any LangGraph graph by passing it in as an argument to the `stream` or `invoke` functions:

```python
from opik.integrations.langchain import OpikTracer
Expand All @@ -55,7 +55,7 @@ Once the OpikTracer is configured, you will start to see the traces in the Opik

## Updating logged traces

You can use the [`OpikTracer.created_traces`](/python-sdk-reference/integrations/langchain/OpikTracer.html#opik.integrations.langchain.OpikTracer.created_traces) method to access the trace IDs collected by the OpikTracer callback:
You can use the [`OpikTracer.created_traces`](https://www.comet.com/docs/opik/python-sdk-reference/integrations/langchain/OpikTracer.html#opik.integrations.langchain.OpikTracer.created_traces) method to access the trace IDs collected by the OpikTracer callback:

```python
from opik.integrations.langchain import OpikTracer
Expand All @@ -68,7 +68,7 @@ traces = opik_tracer.created_traces()
print([trace.id for trace in traces])
```

These can then be used with the [`Opik.log_traces_feedback_scores`](/python-sdk-reference/Opik.html#opik.Opik.log_traces_feedback_scores) method to update the logged traces.
These can then be used with the [`Opik.log_traces_feedback_scores`](https://www.comet.com/docs/opik/python-sdk-reference/Opik.html#opik.Opik.log_traces_feedback_scores) method to update the logged traces.

## Advanced usage

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Opik supports multimodal traces allowing you to track not just the text input an

Images logged to a trace in both base64 encoded images and as URLs are displayed in the trace sidebar.

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:
We recommend that you use the [`track_openai`](https://www.comet.com/docs/opik/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
Expand Down
18 changes: 7 additions & 11 deletions apps/opik-documentation/documentation/docs/tracing/log_traces.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,20 @@ import TabItem from "@theme/TabItem";
If you are just getting started with Opik, we recommend first checking out the [Quickstart](/quickstart.mdx) guide that will walk you through the process of logging your first LLM call.
:::


LLM applications are complex systems that do more than just call an LLM API, they will often involve retrieval, pre-processing and post-processing steps.
Tracing is a tool that helps you understand the flow of your application and identify specific points in your application that may be causing issues.

Opik's tracing functionality allows you to track not just all the LLM calls made by your application but also any of the other steps involved.

![Tracing in Opik](/img/tracing/introduction.png)


Opik provides different ways to log your LLM calls and traces to the platform:

1. **Using one of our [integrations](/tracing/integrations/overview.md):** This is the easiest way to get started.
2. **Using the `@track` decorator:** This allows you to track not just LLM calls but any function call in your application, it is often used in conjunction with the integrations.
3. **Using the Python SDK:** This allows for the most flexibility and customizability and is recommended if you want to have full control over the logging process.
4. **Using the Opik REST API:** If you are not using Python, you can use the REST API to log traces to the platform. The REST API is currently in beta and subject to change.



## Logging with the Python SDK

In order to use the Opik Python SDK, you will need to install it and configure it:
Expand Down Expand Up @@ -280,11 +276,11 @@ def llm_chain(input_text):
)
```

You can learn more about the `opik_context` module in the [opik_context reference docs](/python-sdk-reference/opik_context/index.html).
You can learn more about the `opik_context` module in the [opik_context reference docs](https://www.comet.com/docs/opik/python-sdk-reference/opik_context/index.html).

#### Disabling automatic logging

You can use the `capture_input` and `capture_output` parameters of the [`@track`](/python-sdk-reference/track.html) decorator to disable the automatic logging of the function input and output:
You can use the `capture_input` and `capture_output` parameters of the [`@track`](https://www.comet.com/docs/opik/python-sdk-reference/track.html) decorator to disable the automatic logging of the function input and output:

```python
@track(capture_input=False, capture_output=False)
Expand All @@ -297,12 +293,12 @@ You can then use the `opik_context` module to manually log the trace and span at

### Using the low-level Opik client

If you want full control over the data logged to Opik, you can use the [`Opik`](/python-sdk-reference/Opik.html) client to log traces, spans, feedback scores and more.
If you want full control over the data logged to Opik, you can use the [`Opik`](https://www.comet.com/docs/opik/python-sdk-reference/Opik.html) client to log traces, spans, feedback scores and more.

#### Logging traces and spans

Logging traces and spans can be achieved by first creating a trace using [`Opik.trace`](/python-sdk-reference/Opik.html#opik.Opik.trace)
and then adding spans to the trace using the [`Trace.span`](/python-sdk-reference/Objects/Trace.html#opik.api_objects.trace.Trace.span) method:
Logging traces and spans can be achieved by first creating a trace using [`Opik.trace`](https://www.comet.com/docs/opik/python-sdk-reference/Opik.html#opik.Opik.trace)
and then adding spans to the trace using the [`Trace.span`](https://www.comet.com/docs/opik/python-sdk-reference/Objects/Trace.html#opik.api_objects.trace.Trace.span) method:

```python
from opik import Opik
Expand Down Expand Up @@ -341,8 +337,8 @@ It is recommended to call `trace.end()` and `span.end()` when you are finished w

#### Logging feedback scores

You can log scores to traces and spans using the [`log_traces_feedback_scores`](/python-sdk-reference/Opik.html#opik.Opik.log_traces_feedback_scores)
and [`log_spans_feedback_scores`](/python-sdk-reference/Opik.html#opik.Opik.log_spans_feedback_scores) methods:
You can log scores to traces and spans using the [`log_traces_feedback_scores`](https://www.comet.com/docs/opik/python-sdk-reference/Opik.html#opik.Opik.log_traces_feedback_scores)
and [`log_spans_feedback_scores`](https://www.comet.com/docs/opik/python-sdk-reference/Opik.html#opik.Opik.log_spans_feedback_scores) methods:

```python
from opik import Opik
Expand Down

0 comments on commit db41555

Please sign in to comment.