You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The attribute for gen_ai.prompt.N.* is not set correctly. Yes, I know we will soon/eventually move to sending these as events, but for now, this is an error.
👟 Reproduction steps
import google.generativeai as genai
import os
from traceloop.sdk import Traceloop
Traceloop.init()
genai.configure(api_key=os.environ['GEMINI_API_KEY'])
model = genai.GenerativeModel('gemini-1.5-flash')
def gemini_response(user_message: str):
response = model.generate_content(user_message)
print(response.text)
gemini_response('The opposite of hot is')
👍 Expected behavior
The following prompt and completion attributes must be set (by analogy with openai and anthropic):
gen_ai.prompt.0.content: "The opposite of hot is\n"
gen_ai.prompt.0.role: "user"
gen_ai.completion.0.content: "cold\n"
gen_ai.completion.0.role: "assistant"
👎 Actual Behavior with Screenshots
Instead, these attributes are set:
gen_ai.completion.0.content: "cold\n"
gen_ai.prompt.0.user: "The opposite of hot is\n"
🤖 Python Version
3.12
📃 Provide any additional context for the Bug.
No response
👀 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?
Yes I am willing to submit a PR!
The text was updated successfully, but these errors were encountered:
To address the issue with the incorrect setting of input message attributes for gen_ai.prompt.N.* in the Gemini instrumentation, you can modify the _set_input_attributes function to ensure that the attributes are set correctly based on the request type. Here's a suggested approach:
Modify the _set_input_attributes function to correctly set the gen_ai.prompt.N.* attributes. Ensure that the prompt and role are set according to the expected behavior.
Ensure the completion attributes are set correctly in the _set_span_completions function, similar to how the prompt attributes are set.
This approach will align the attribute setting with the expected behavior, ensuring that both the content and role are correctly recorded for prompts and completions [1][2].
Which component is this bug for?
All Packages
📜 Description
The attribute for
gen_ai.prompt.N.*
is not set correctly. Yes, I know we will soon/eventually move to sending these as events, but for now, this is an error.👟 Reproduction steps
👍 Expected behavior
The following prompt and completion attributes must be set (by analogy with openai and anthropic):
👎 Actual Behavior with Screenshots
Instead, these attributes are set:
🤖 Python Version
3.12
📃 Provide any additional context for the Bug.
No response
👀 Have you spent some time to check if this bug has been raised before?
Are you willing to submit PR?
Yes I am willing to submit a PR!
The text was updated successfully, but these errors were encountered: