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

Event attribute validation #2535

Merged
merged 6 commits into from
Mar 29, 2024
Merged

Event attribute validation #2535

merged 6 commits into from
Mar 29, 2024

Conversation

hannahramadan
Copy link
Contributor

@hannahramadan hannahramadan commented Mar 28, 2024

Add tests to validate the desired attributed exist on chat completion, message, and embedding events.

Through testing, it was discovered that the request_temperature on chat completion events was not being assigned. That has been fix and a CHANGELOG reflects this change.

closes #2440

@hannahramadan hannahramadan changed the title Add tests for event attribute validation Event attribute validation Mar 28, 2024
@@ -158,7 +230,7 @@ def test_llm_custom_attributes_added_to_embedding_events
'triceratops' => 'herbivore'
})
stub_post_request do
client.embeddings(parameters: chat_params)
client.embeddings(parameters: embeddings_params)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test is ensuring llm. custom events are added. This change doesn't affect the test, but it always should've been embeddings_params.

@hannahramadan hannahramadan marked this pull request as ready for review March 28, 2024 22:40
CHANGELOG.md Outdated Show resolved Hide resolved
Co-authored-by: James Bunch <[email protected]>
assert attributes['request.model']
assert attributes['response.choices.finish_reason']
assert attributes['request.temperature']
assert attributes['duration']
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does assert ensure that each of the values would survive an #empty? check or simply a #nil? one?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great callout. I'll change these asserts to refute_empty for the hash values.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fallwith changed this 46c2dfb

fallwith
fallwith previously approved these changes Mar 28, 2024
kaylareopelle
kaylareopelle previously approved these changes Mar 29, 2024
Copy link
Contributor

@kaylareopelle kaylareopelle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this looks great as-is! I have a few suggestions, but nothing you need to address now and can also disregard altogether :)

CHANGELOG.md Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
@hannahramadan hannahramadan dismissed stale reviews from kaylareopelle and fallwith via 3585f2d March 29, 2024 16:27
Co-authored-by: Kayla Reopelle (she/her) <[email protected]>
Copy link
Contributor

SimpleCov Report

Coverage Threshold
Line 93.72% 93%
Branch 71.26% 71%

@hannahramadan hannahramadan merged commit 0084d34 into dev Mar 29, 2024
30 checks passed
@hannahramadan hannahramadan deleted the llm_event_attributes_tests branch March 29, 2024 20:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

OpenAI: Test: validate all attributes are assigned to LLM events through instrumentation
3 participants