Skip to content

Commit 00e08a8

Browse files
committed
safeguard against empty request-model
1 parent 742a36f commit 00e08a8

File tree

1 file changed

+2
-0
lines changed
  • util/opentelemetry-util-genai/src/opentelemetry/util/genai

1 file changed

+2
-0
lines changed

util/opentelemetry-util-genai/src/opentelemetry/util/genai/generators.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ def __init__(
8989

9090
def start(self, invocation: LLMInvocation):
9191
# Create a span and attach it as current; keep the token to detach later
92+
if not (invocation.request_model and invocation.request_model.strip()):
93+
raise ValueError("request_model is required")
9294
span = self._tracer.start_span(
9395
name=f"{GenAI.GenAiOperationNameValues.CHAT.value} {invocation.request_model}",
9496
kind=SpanKind.CLIENT,

0 commit comments

Comments
 (0)