Skip to content

Commit

Permalink
chore: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
nirga authored and 5war00p committed Dec 24, 2023
1 parent b5ad45e commit f98dc0b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ def _set_span_attribute(span, name, value):
span.set_attribute(name, value)
return


input_attribute_map = {
"prompt": f"{SpanAttributes.LLM_PROMPTS}.0.user",
"temperature": SpanAttributes.LLM_TEMPERATURE,
Expand Down Expand Up @@ -137,6 +138,7 @@ def _handle_request(span, args, kwargs):
"Failed to set input attributes for replicate span, error: %s", str(ex)
)


def _handle_response(span, response):
try:
if span.is_recording():
Expand All @@ -150,6 +152,7 @@ def _handle_response(span, response):
if span.is_recording():
span.set_status(Status(StatusCode.OK))


def _with_tracer_wrapper(func):
"""Helper for providing tracer for wrapper functions."""

Expand Down
15 changes: 7 additions & 8 deletions packages/traceloop-sdk/tests/test_replicate_instrumentaion.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@
def test_replicate_image_generation(exporter):
@task(name="image_generation")
def generate_image():
image = replicate.run(
replicate.run(
"stability-ai/stable-diffusion:27b93a2413e7f36cd83da926f3656280b2931564ff050bf9575f1fdf9bcd7478",
input={"prompt": "robots"}
input={"prompt": "robots"},
)


@workflow(name="robot_image_generator")
def image_workflow():
generate_image()
Expand All @@ -24,6 +23,7 @@ def image_workflow():
"robot_image_generator.workflow",
]


def test_replicate_image_generation_stream(exporter):
@task(name="image_generation_stream")
def generate_image_stream():
Expand All @@ -49,16 +49,15 @@ def image_workflow():
"robot_image_generator_stream.workflow",
]


def test_replicate_image_generation_predictions(exporter):
@task(name="image_generation_predictions")
def generate_image_predictions():
model = replicate.models.get("kvfrans/clipdraw")
version = model.versions.get("5797a99edc939ea0e9242d5e8c9cb3bc7d125b1eac21bda852e5cb79ede2cd9b")
prediction = replicate.predictions.create(
version,
input={"prompt": "robots"}
version = model.versions.get(
"5797a99edc939ea0e9242d5e8c9cb3bc7d125b1eac21bda852e5cb79ede2cd9b"
)

replicate.predictions.create(version, input={"prompt": "robots"})

@workflow(name="robot_image_generator_predictions")
def image_workflow():
Expand Down

0 comments on commit f98dc0b

Please sign in to comment.