-
Notifications
You must be signed in to change notification settings - Fork 825
Open
Labels
bugSomething isn't workingSomething isn't workinggen-aiRelated to generative AIRelated to generative AI
Description
Describe your environment
Package version: 2.2b0
What happened?
File: patch.py
Line: 397
set_span_attribute(
span, GenAIAttributes.GEN_AI_RESPONSE_MODEL, result.model
)
should add " if getattr(result, "model", None) " , cause sometime result has no attribute "model"
Steps to Reproduce
client = openai.OpenAI()
messages = [
{
"role": "user",
"content": TEST_CHAT_INPUT,
}
]
raw_response = client.chat.completions.with_raw_response.create(model=TEST_CHAT_MODEL, messages=messages)
chat_completion = raw_response.parse()
assert chat_completion.choices[0].message.content
and stream
client = openai.OpenAI()
messages = [
{
"role": "user",
"content": TEST_CHAT_INPUT,
}
]
raw_response = client.chat.completions.with_raw_response.create(
model=TEST_CHAT_MODEL, messages=messages, stream=True
)
# Explicit parse of the raw response
chat_completion = raw_response.parse()
chunks = [chunk.choices[0].delta.content or "" for chunk in chat_completion if chunk.choices]
assert "".join(chunks)
Expected Result
no crash
Actual Result
exception raised
Additional context
No response
Would you like to implement a fix?
Yes
Tip
React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workinggen-aiRelated to generative AIRelated to generative AI
Type
Projects
Status
New issues