mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-27 11:43:54 +00:00
simple test
This commit is contained in:
parent
541336a001
commit
6652227c25
2 changed files with 26 additions and 27 deletions
26
litellm/tests/test_opentelemetry.py
Normal file
26
litellm/tests/test_opentelemetry.py
Normal file
|
@ -0,0 +1,26 @@
|
|||
import asyncio
|
||||
import litellm
|
||||
|
||||
from litellm.integrations.opentelemetry import OpenTelemetry, OpenTelemetryConfig
|
||||
from opentelemetry.sdk.trace.export.in_memory_span_exporter import InMemorySpanExporter
|
||||
|
||||
|
||||
def test_otel_callback():
|
||||
exporter = InMemorySpanExporter()
|
||||
|
||||
litellm.callbacks = [OpenTelemetry(OpenTelemetryConfig(exporter=exporter))]
|
||||
|
||||
litellm.completion(
|
||||
model="gpt-3.5-turbo",
|
||||
messages=[{"role": "user", "content": "hi"}],
|
||||
)
|
||||
|
||||
asyncio.run(
|
||||
litellm.acompletion(
|
||||
model="gpt-3.5-turbo",
|
||||
messages=[{"role": "user", "content": "hi"}],
|
||||
)
|
||||
)
|
||||
|
||||
spans = exporter.get_finished_spans()
|
||||
assert len(spans) == 1 + 1
|
Loading…
Add table
Add a link
Reference in a new issue