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

Create set_llm_token_count_callback API #2485

Merged
merged 2 commits into from
Mar 6, 2024

Conversation

kaylareopelle
Copy link
Contributor

The API accepts one argument, a proc, that should contain the callback the agent will invoke if it cannot glean the token count from instrumentation.

A supportability metric is recorded when the API is called.

Closes: #2451

The API accepts one argument, a proc, that should contain the callback
the agent will invoke if it cannot glean the token count from
instrumentation.

A supportability metric is recorded when the API is called.
Copy link
Contributor

@fallwith fallwith left a comment

Choose a reason for hiding this comment

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

This one gave me a bit of proc déjà vu.

@kaylareopelle
Copy link
Contributor Author

This one gave me a bit of proc déjà vu.

Your work on the error callback made this easy!

#
# @param callback_proc [Proc] the callback proc
#
# Typically this method should be called only once to set a callback for
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need the word 'typically'?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think so. This documentation was drawn from another one of our APIs. I'll remove!

lib/new_relic/agent.rb Outdated Show resolved Hide resolved
Copy link
Contributor

github-actions bot commented Mar 6, 2024

SimpleCov Report

Coverage Threshold
Line 93.69% 93%
Branch 71.39% 71%

@hannahramadan hannahramadan merged commit 588e23a into openai_instrumentation Mar 6, 2024
28 checks passed
@hannahramadan hannahramadan deleted the set_llm_token_count_callback branch March 6, 2024 21:51
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.

AIM/OpenAI: Create callback to record client-side token count
3 participants