Skip to content

Commit

Permalink
Fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
robertlacok committed Jan 3, 2025
1 parent 5db762d commit cf21d09
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions sdks/python/examples/demo_data_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@

UUID_MAP = {}


def get_new_uuid(old_id):
"""
The demo_data has the IDs hardcoded in, to preserve the relationships between the traces and spans.
However, we need to generate unique ones before logging them.
However, we need to generate unique ones before logging them.
"""
if old_id in UUID_MAP:
new_id = UUID_MAP[old_id]
Expand All @@ -23,9 +24,15 @@ def get_new_uuid(old_id):
UUID_MAP[old_id] = new_id
return new_id


def create_demo_data(base_url: str, workspace_name, comet_api_key):

client = opik.Opik(project_name="Demo evaluation", workspace=workspace_name, host=base_url, api_key=comet_api_key)

client = opik.Opik(
project_name="Demo evaluation",
workspace=workspace_name,
host=base_url,
api_key=comet_api_key,
)

for trace in sorted(evaluation_traces, key=lambda x: x["start_time"]):
new_id = get_new_uuid(trace["id"])
Expand All @@ -46,7 +53,12 @@ def create_demo_data(base_url: str, workspace_name, comet_api_key):
# We have a simple chatbot application built using llama-index.
# We gave it the content of Opik documentation as context, and then asked it a few questions.

client = opik.Opik(project_name="Demo chatbot 🤖", workspace=workspace_name, host=base_url, api_key=comet_api_key)
client = opik.Opik(
project_name="Demo chatbot 🤖",
workspace=workspace_name,
host=base_url,
api_key=comet_api_key,
)

for trace in sorted(demo_traces, key=lambda x: x["start_time"]):
new_id = get_new_uuid(trace["id"])
Expand Down

0 comments on commit cf21d09

Please sign in to comment.