-
Notifications
You must be signed in to change notification settings - Fork 235
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
132 additions
and
53 deletions.
There are no files selected for viewing
6 changes: 3 additions & 3 deletions
6
...entation/python-sdk-docs/source/Comet.rst → ...mentation/python-sdk-docs/source/Opik.rst
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 @@ | ||
Comet | ||
===== | ||
Opik | ||
==== | ||
|
||
.. autoclass:: opik.Comet | ||
.. autoclass:: opik.Opik | ||
:members: | ||
:inherited-members: | ||
|
4 changes: 0 additions & 4 deletions
4
apps/opik-documentation/python-sdk-docs/source/comet_context/get_current_span.rst
This file was deleted.
Oops, something went wrong.
4 changes: 0 additions & 4 deletions
4
apps/opik-documentation/python-sdk-docs/source/comet_context/get_current_trace.rst
This file was deleted.
Oops, something went wrong.
10 changes: 0 additions & 10 deletions
10
apps/opik-documentation/python-sdk-docs/source/comet_context/index.rst
This file was deleted.
Oops, something went wrong.
19 changes: 18 additions & 1 deletion
19
apps/opik-documentation/python-sdk-docs/source/evaluation/metrics/index.rst
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
5 changes: 0 additions & 5 deletions
5
...pik-documentation/python-sdk-docs/source/integrations/langchain/CometTracer.rst
This file was deleted.
Oops, something went wrong.
5 changes: 5 additions & 0 deletions
5
...opik-documentation/python-sdk-docs/source/integrations/langchain/OpikTracer.rst
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,5 @@ | ||
OpikTracer | ||
========== | ||
|
||
.. autoclass:: opik.integrations.langchain.OpikTracer | ||
:members: |
29 changes: 27 additions & 2 deletions
29
apps/opik-documentation/python-sdk-docs/source/integrations/langchain/index.rst
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,9 +1,34 @@ | ||
langchain | ||
========= | ||
|
||
Opik integrates with Langchain to allow you to log your Langchain calls to the Opik platform, simply wrap the Langchain client with `OpikTracer` to start logging:: | ||
|
||
from langchain.chains import LLMChain | ||
from langchain_openai import OpenAI | ||
from langchain.prompts import PromptTemplate | ||
from opik.integrations.langchain import OpikTracer | ||
|
||
# Initialize the tracer | ||
opik_tracer = OpikTracer() | ||
|
||
# Create the LLM Chain using LangChain | ||
llm = OpenAI(temperature=0) | ||
|
||
prompt_template = PromptTemplate( | ||
input_variables=["input"], | ||
template="Translate the following text to French: {input}" | ||
) | ||
|
||
llm_chain = LLMChain(llm=llm, prompt=prompt_template) | ||
|
||
# Generate the translations | ||
translation = llm_chain.run("Hello, how are you?", callbacks=[opik_tracer]) | ||
print(translation) | ||
|
||
You can learn more about the `OpikTracer` decorator in the following section: | ||
|
||
.. toctree:: | ||
:hidden: | ||
:maxdepth: 4 | ||
:titlesonly: | ||
|
||
CometTracer | ||
OpikTracer |
17 changes: 15 additions & 2 deletions
17
apps/opik-documentation/python-sdk-docs/source/integrations/openai/index.rst
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,9 +1,22 @@ | ||
openai | ||
======= | ||
|
||
Opik integrates with OpenAI to allow you to log your OpenAI calls to the Opik platform, simply wrap the OpenAI client with `track_openai` to start logging:: | ||
|
||
from opik.integrations.openai import openai_wrapper | ||
from openai import OpenAI | ||
|
||
openai_client = OpenAI() | ||
openai_client = openai_wrapper(openai_client) | ||
|
||
response = openai_client.Completion.create( | ||
prompt="Hello, world!", | ||
) | ||
|
||
You can learn more about the `track_openai` decorator in the following section: | ||
|
||
.. toctree:: | ||
:hidden: | ||
:maxdepth: 4 | ||
:titlesonly: | ||
|
||
track_openai | ||
track_openai |
4 changes: 4 additions & 0 deletions
4
apps/opik-documentation/python-sdk-docs/source/opik_context/get_current_span.rst
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,4 @@ | ||
get_current_span | ||
================ | ||
|
||
.. autofunction:: opik.opik_context.get_current_span |
4 changes: 4 additions & 0 deletions
4
apps/opik-documentation/python-sdk-docs/source/opik_context/get_current_trace.rst
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,4 @@ | ||
get_current_trace | ||
================= | ||
|
||
.. autofunction:: opik.opik_context.get_current_trace |
20 changes: 20 additions & 0 deletions
20
apps/opik-documentation/python-sdk-docs/source/opik_context/index.rst
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,20 @@ | ||
opik_context | ||
============ | ||
|
||
The opik context module provides a way to access the current span and trace from within a tracked function:: | ||
|
||
from opik import opik_context, track | ||
|
||
@track | ||
def my_function(): | ||
span = opik_context.get_current_span() | ||
trace = opik_context.get_current_trace() | ||
|
||
You can learn more about each function in the following sections: | ||
|
||
.. toctree:: | ||
:maxdepth: 4 | ||
:titlesonly: | ||
|
||
get_current_span | ||
get_current_trace |
7 changes: 7 additions & 0 deletions
7
apps/opik-documentation/python-sdk-docs/source/testing/llm_unit.rst
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,7 @@ | ||
llm_unit | ||
======== | ||
|
||
.. autoclass:: opik.llm_unit | ||
:members: | ||
:inherited-members: | ||
|