mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-02 02:11:58 +00:00
wip
This commit is contained in:
parent
a76d36718b
commit
5aacd57455
5 changed files with 10 additions and 6 deletions
|
|
@ -162,7 +162,7 @@ async fn retried_trace_insert_does_not_inflate_rollup(
|
|||
let database = database?;
|
||||
let writer = Connection::writer(&database.url)?;
|
||||
ensure_schema(&database.client, &writer, "trace_test", 7, 14).await?;
|
||||
let row = serde_json::from_value(serde_json::json!({
|
||||
let row: BTreeMap<String, serde_json::Value> = serde_json::from_value(serde_json::json!({
|
||||
"Timestamp": time::OffsetDateTime::now_utc().unix_timestamp_nanos() as i64,
|
||||
"TraceId": "retried-trace", "SpanId": "span-1", "ParentSpanId": "",
|
||||
"TeamId": "team-1", "ApiKeyHash": "key-1", "SpanName": "root", "InputTokens": 7
|
||||
|
|
|
|||
|
|
@ -160,7 +160,9 @@ def _langsmith_io(row: SpanRow, attributes: Mapping[str, str]) -> None:
|
|||
if row["ObservationType"] == "llm" and isinstance(completion, dict):
|
||||
messages = prompt_payload.get("messages") or [[]]
|
||||
batch = messages[0] if messages and isinstance(messages[0], list) else messages
|
||||
row["Input"] = json.dumps([_lc_message(m) for m in batch if isinstance(m, dict)]) if isinstance(batch, list) else ""
|
||||
row["Input"] = (
|
||||
json.dumps([_lc_message(m) for m in batch if isinstance(m, dict)]) if isinstance(batch, list) else ""
|
||||
)
|
||||
generations: Final = completion.get("generations")
|
||||
first: Final = generations[0] if isinstance(generations, list) and generations else None
|
||||
item: Final = first[0] if isinstance(first, list) and first else None
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ from litellm.constants import (
|
|||
)
|
||||
from litellm.integrations.clickhouse.schema import ensure_schema
|
||||
from litellm.rust_bridge.traces import TraceStorage
|
||||
from litellm.tracing.decode import InvalidOTLPPayloadError, OTLPPayloadTooLargeError, decode_otlp
|
||||
from litellm.tracing.decode import OTLPPayloadTooLargeError, decode_otlp
|
||||
from litellm.tracing.store import ClickHouseTraceStore
|
||||
from litellm.tracing.types import (
|
||||
SpanDetail,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import io
|
||||
import gzip
|
||||
import io
|
||||
import json
|
||||
from typing import get_type_hints
|
||||
from unittest.mock import AsyncMock, MagicMock, patch
|
||||
|
|
@ -31,7 +31,9 @@ from litellm.proxy.common_utils.http_parsing_utils import (
|
|||
)
|
||||
|
||||
|
||||
def _starlette_request(body: bytes, content_type: str, path: str = "/v1/messages", content_encoding: str = "") -> Request:
|
||||
def _starlette_request(
|
||||
body: bytes, content_type: str, path: str = "/v1/messages", content_encoding: str = ""
|
||||
) -> Request:
|
||||
scope = {
|
||||
"type": "http",
|
||||
"method": "POST",
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ sys.path.insert(0, os.path.abspath("../../.."))
|
|||
|
||||
import pytest
|
||||
|
||||
from litellm.tracing.types import TraceScope
|
||||
from litellm.tracing.store import (
|
||||
ClickHouseTraceStore,
|
||||
agent_nodes,
|
||||
|
|
@ -21,6 +20,7 @@ from litellm.tracing.store import (
|
|||
trace_from_rows,
|
||||
trace_summary_from_row,
|
||||
)
|
||||
from litellm.tracing.types import TraceScope
|
||||
|
||||
T0 = 1_790_742_989_000_000_000 # ns
|
||||
MS = 1_000_000
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue