-
Notifications
You must be signed in to change notification settings - Fork 48
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(crewai): Add SpanKind and Token Count attributes #867
Conversation
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use footers to trigger release please release notes notes instead of making the title a "multi-title". See https://github.com/googleapis/release-please?tab=readme-ov-file#what-if-my-pr-contains-multiple-fixes-or-features
PS: would love a training session on vrcpy ;)
python/examples/llama-index/backend/app/engine/loaders/__init__.py
Outdated
Show resolved
Hide resolved
...n/openinference-instrumentation-crewai/src/openinference/instrumentation/crewai/_wrappers.py
Outdated
Show resolved
Hide resolved
...n/openinference-instrumentation-crewai/src/openinference/instrumentation/crewai/_wrappers.py
Outdated
Show resolved
Hide resolved
...n/openinference-instrumentation-crewai/src/openinference/instrumentation/crewai/_wrappers.py
Outdated
Show resolved
Hide resolved
...rence-instrumentation-crewai/tests/openinference/instrumentation/crewai/test_instrumentor.py
Show resolved
Hide resolved
python/instrumentation/openinference-instrumentation-litellm/guides/client_demo.ipynb
Outdated
Show resolved
Hide resolved
...mentation/openinference-instrumentation-promptflow/examples/chat_flow_example_to_arize.ipynb
Outdated
Show resolved
Hide resolved
...ntation/openinference-instrumentation-promptflow/examples/chat_flow_example_to_phoenix.ipynb
Outdated
Show resolved
Hide resolved
if "prompt_tokens" in usage_metrics: | ||
span.set_attribute(LLM_TOKEN_COUNT_PROMPT, int(usage_metrics["prompt_tokens"])) | ||
if "completion_tokens" in usage_metrics: | ||
span.set_attribute(LLM_TOKEN_COUNT_COMPLETION, int(usage_metrics["completion_tokens"])) | ||
if "total_tokens" in usage_metrics: | ||
span.set_attribute(LLM_TOKEN_COUNT_TOTAL, int(usage_metrics["total_tokens"])) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if "prompt_tokens" in usage_metrics: | |
span.set_attribute(LLM_TOKEN_COUNT_PROMPT, int(usage_metrics["prompt_tokens"])) | |
if "completion_tokens" in usage_metrics: | |
span.set_attribute(LLM_TOKEN_COUNT_COMPLETION, int(usage_metrics["completion_tokens"])) | |
if "total_tokens" in usage_metrics: | |
span.set_attribute(LLM_TOKEN_COUNT_TOTAL, int(usage_metrics["total_tokens"])) | |
if prompt_tokens := usage_metrics.get("prompt_tokens"): | |
span.set_attribute(LLM_TOKEN_COUNT_PROMPT, int(prompt_tokens)) | |
if completion_tokens := usage_metrics.get("completion_tokens"): | |
span.set_attribute(LLM_TOKEN_COUNT_COMPLETION, int(completion_tokens)) | |
if total_tokens := usage_metrics.get("total_tokens"): | |
span.set_attribute(LLM_TOKEN_COUNT_TOTAL, int(total_tokens)) |
span.set_attribute(LLM_TOKEN_COUNT_PROMPT, usage_metrics.prompt_tokens) | ||
span.set_attribute(LLM_TOKEN_COUNT_COMPLETION, usage_metrics.completion_tokens) | ||
span.set_attribute(LLM_TOKEN_COUNT_TOTAL, usage_metrics.total_tokens) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we absolutely certain these are set?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yea in later versions it's set right before the end of the kickoff
main function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this litellm notebook be in this PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reminder about the PR title (comment above)
resolves Arize-ai/phoenix#4200
fix(crewai): add basic unit tests