🐛 Bug Report: LiteLLM instrumentation does not record seed, stop, frequency_penalty, presence_penalty
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 85/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- python
- Lĩnh vực
- ai, observability
Hướng nghiên cứu
Bắt đầu với _set_request_attributes trong opentelemetry/instrumentation/litellm/__init__.py và so sánh ánh xạ thuộc tính yêu cầu của hàm với callback LiteLLM. Dùng bản tái hiện được cung cấp để xác nhận các thuộc tính GenAI nào được phát ra, sau đó bổ sung phạm vi kiểm thử cho seed, stop, frequency_penalty và presence_penalty trong khi giữ nguyên các thuộc tính hiện có. Hoàn thành nghĩa là cả bốn tham số đều xuất hiện với các tên gen_ai.request.* đã chỉ định khi được cung cấp.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Which component is this bug for?
AlephAlpha Instrumentation
📜 Description
Package: opentelemetry-instrumentation-litellm 0.62.4 (not in the component list, so I picked the closest option).
_set_request_attributes in the LiteLLM instrumentation (opentelemetry/instrumentation/litellm/__init__.py, lines 166-178 at 0.62.4) records only gen_ai.request.model, temperature, top_p and max_tokens. Request parameters that the GenAI semantic conventions define and that LiteLLM forwards to the provider are dropped: gen_ai.request.seed, gen_ai.request.stop_sequences, gen_ai.request.frequency_penalty, gen_ai.request.presence_penalty. A trace therefore cannot show why two otherwise identical calls behaved differently.
For comparison, LiteLLM's own OpenTelemetry callback records all of them for the same call. Related: #4538 covers seed / stop_sequences in the OpenAI package; this is the separate LiteLLM package, which also misses the penalties.
👟 Reproduction steps
pip install litellm opentelemetry-instrumentation-litellm opentelemetry-sdk httpx
import os
os.environ["LITELLM_LOCAL_MODEL_COST_MAP"] = "True"
import httpx, litellm, openai
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import SimpleSpanProcessor
from opentelemetry.sdk.trace.export.in_memory_span_exporter import InMemorySpanExporter
from opentelemetry.instrumentation.litellm import LiteLLMInstrumentor
exporter = InMemorySpanExporter()
provider = TracerProvider()
provider.add_span_processor(SimpleSpanProcessor(exporter))
LiteLLMInstrumentor().instrument(tracer_provider=provider)
client = openai.OpenAI(api_key="x", max_retries=0, http_client=httpx.Client(transport=httpx.MockTransport(
lambda r: httpx.Response(200, json={"id": "c1", "object": "chat.completion", "created": 0, "model": "gpt-4o-mini",
"choices": [{"index": 0, "message": {"role": "assistant", "content": "Hello"}, "finish_reason": "stop"}],
"usage": {"prompt_tokens": 11, "completion_tokens": 5, "total_tokens": 16}}))))
litellm.completion(model="openai/gpt-4o-mini", messages=[{"role": "user", "content": "hi"}], client=client, api_key="x",
seed=7, stop=["END"], temperature=0.3, top_p=0.9, max_tokens=50,
frequency_penalty=0.1, presence_penalty=0.2)
print({k: v for k, v in exporter.get_finished_spans()[0].attributes.items() if k.startswith("gen_ai.request.")})
👍 Expected behavior
gen_ai.request.seed, gen_ai.request.stop_sequences, gen_ai.request.frequency_penalty and gen_ai.request.presence_penalty are set when the call passes them.
👎 Actual Behavior with Screenshots
gen_ai.request.model = openai/gpt-4o-mini
gen_ai.request.temperature = 0.3
gen_ai.request.top_p = 0.9
gen_ai.request.max_tokens = 50
(seed, stop, frequency_penalty and presence_penalty were sent but are not recorded)
🤖 Python Version
3.12
📃 Provide any additional context for the Bug.
opentelemetry-instrumentation-litellm 0.62.4 (the latest release), litellm 1.104.2.
👀 Have you spent some time to check if this bug has been raised before?
- I checked and didn't find similar issue
Are you willing to submit PR?
None
- Ngôn ngữ chính
- Python
- Star
- 7.5k
- Fork
- 1.2k
- Merge trung bình
- 2 ngày 6 giờ
- Pull request đã merge (30 ngày)
- 2
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của traceloop/openllmetry
-
bug python
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
traceloop/openllmetry#4717 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
🐛 Bug Report: Incomplete cache token migration after #4243 breaks Bedrock and Groq instrumentationCó thể đã có người làm @Quantum-Enigma-dot đã nhận 21 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
traceloop/openllmetry#4665 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
🐛 Bug Report: OpenAI instrumentation drops gen_ai.usage.reasoning_tokens on streamed chat completionsCó thể đã có người làm @jayfeng7 đã nhận 23 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
traceloop/openllmetry#4660 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Bug Report: Failed dataset deletes still remove local rows and columnsCó thể đã có người làm @inchang-ing đã nhận 32 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
traceloop/openllmetry#4630 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
🐛 Bug Report: LiteLLM instrumentation never ends the span when a call is interrupted (KeyboardInterrupt, asyncio cancellation)Có thể đã có người làm @rupak-eng đã nhận 39 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 80/100
traceloop/openllmetry#4597 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của traceloop/openllmetry
Issue tương tự
-
Internal ErrorĐang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
frappe/frappe_docker#2071 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
The-Pocket/PocketFlow#161 ·
-
[Bug]: Webapp workspace fails to render in Safari — "Can't find variable: requestIdleCallback"Đang mởcomp/desktop P2 type/bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
NousResearch/hermes-agent#157702 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
scibench_physics / scibench_chemistry: a correct answer scores 0 when the unit has a power of tenCó thể đã có người làm @BahaaMattar đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
EvolvingLMMs-Lab/lmms-eval#1699 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
project_inputs.html uses undefined file variable for dropdown IDs, lacks visual tag badges, and has empty delete labelsCó thể đã có người làm @Rucha0901 đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
aboutcode-org/scancode.io#2354 ·
Maintainer thường phản hồi trong vòng 1 ngày