Buckets:
AnonymousSpottedToad/candidate_bucket / codebase /python /amphetamarina_litellm /tests /local_testing /test_logfire.py
| import asyncio | |
| import json | |
| import logging | |
| import os | |
| import sys | |
| import time | |
| import pytest | |
| import litellm | |
| from litellm._logging import verbose_logger, verbose_proxy_logger | |
| verbose_logger.setLevel(logging.DEBUG) | |
| sys.path.insert(0, os.path.abspath("../..")) | |
| # Testing scenarios for logfire logging: | |
| # 1. Test logfire logging for completion | |
| # 2. Test logfire logging for acompletion | |
| # 3. Test logfire logging for completion while streaming is enabled | |
| # 4. Test logfire logging for completion while streaming is enabled | |
| def test_completion_logfire_logging(stream): | |
| from litellm.integrations.opentelemetry import OpenTelemetry, OpenTelemetryConfig | |
| litellm.callbacks = ["logfire"] | |
| litellm.set_verbose = True | |
| messages = [{"role": "user", "content": "what llm are u"}] | |
| temperature = 0.3 | |
| max_tokens = 10 | |
| response = litellm.completion( | |
| model="gpt-3.5-turbo", | |
| messages=messages, | |
| max_tokens=max_tokens, | |
| temperature=temperature, | |
| stream=stream, | |
| ) | |
| print(response) | |
| if stream: | |
| for chunk in response: | |
| print(chunk) | |
| time.sleep(5) | |
| async def test_acompletion_logfire_logging(stream): | |
| from litellm.integrations.opentelemetry import OpenTelemetry, OpenTelemetryConfig | |
| litellm.callbacks = ["logfire"] | |
| litellm.set_verbose = True | |
| messages = [{"role": "user", "content": "what llm are u"}] | |
| temperature = 0.3 | |
| max_tokens = 10 | |
| response = await litellm.acompletion( | |
| model="gpt-3.5-turbo", | |
| messages=messages, | |
| max_tokens=max_tokens, | |
| temperature=temperature, | |
| stream=stream, | |
| ) | |
| print(response) | |
| if stream: | |
| async for chunk in response: | |
| print(chunk) | |
| await asyncio.sleep(5) | |
Xet Storage Details
- Size:
- 2 kB
- Xet hash:
- 3b517a27e1d2cbeb4917a231aff0d7ec0299b930c7fb6c80e98d41a4d87830ab
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.