Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feat]: Capture LLM Prompts and Responses in Trace Events #354

Merged
merged 6 commits into from
Aug 1, 2024
Merged

Conversation

patcher9
Copy link
Contributor

@patcher9 patcher9 commented Aug 1, 2024

Overview:

This PR places LLM Prompts and Responses in Trace Events rather than the Span Attributes to better align with the OTel GenAI Semantic conventions.

Related #342 (comment)

Changes:

  • Prompt is now captured under event name gen_ai.content.prompt with Event attribute name as gen_ai.prompt
  • Completions is now captured under event name gen_ai.content.completion with Event attribute name as gen_ai.completion
  • Make gen_ai.response.finish_reasons as string[]
"events": [
       {
           "name": "gen_ai.content.prompt",
           "timestamp": "2024-08-01T07:09:15.763840Z",
           "attributes": {
               "gen_ai.prompt": "user: text: How are you?\n"
           }
       },
       {
           "name": "gen_ai.content.completion",
           "timestamp": "2024-08-01T07:09:15.763877Z",
           "attributes": {
               "gen_ai.completion": "I am Amazon Titan, a large language model built by AWS. It is designed to assist you with tasks and answer any questions you may have. How may I help you?"
           }
       }
   ],

Visuals (If applicable):

NA

Checklist:

  • PR name follows conventional commit format: [Feat]: ... or [Fix]: ....
  • Added visuals for changes (If applicable)
  • Checked OpenLIT contribution guidelines

@patcher9 patcher9 merged commit ae20042 into main Aug 1, 2024
9 checks passed
@patcher9 patcher9 deleted the use-events branch August 1, 2024 09:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant