* opentelemetry-instrumentation-botocore: fix handling of tool input chunked json in converse_stream
We need to accumulate all the tool input as string before decoding it
otherwise we may end up with invalid json.
* Add changelog
* Remove leftover print
* No need for too-many-statements disable
Amazon Bedrock tool use extraction logic doesn't agree with som of the use cases (conversation construction), such as the case with pre-created assistant message:
'messages': [{"role": "user", "content": "Placeholder text."}, {"role": "assistant", "content": "{"}],
This PR addresses this by adding a dict type check on the message content before attempting to get the value of `tool_use`from the content.
* Ensure spans end on early stream closure for Bedrock Streaming APIs
* Add changelog
* End span only if it's still recording in stream done callbacks. Assert that span status is unset.
* Extract response output and stream content into helper functions
* Update changelog after 1.33.0 release
* Keep track of bedrock stream ending and close spans accordingly
* Move stream output checks to a single method
* Update CHANGELOG.md
---------
Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
* Update botocore instrumentation to use semantic convention attribute for cloud region
* Update changelog
* Move cloud region attribute to the breaking changes in the changelog
---------
Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
* Capture server attributes for botocore API calls
* fix: use typing.Dict for 3.8 compatibility and resolve failing tests
* Update changelog
* Add server and port assertions for Bedrock API calls
* Add server address and port to Bedrock metric attributes
* Add license header and deferred type hint evaluation in utils.py
* Refactor metric attributes creation and add linter suppression (too-many-lines) for bedrock.py
---------
Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
This adds basic request and response gen_ai instrumentation for the following Bedrock model providers:
Cohere Command and Command R, Meta Llama, Mistral AI
* Update version to 1.33.0.dev/0.54b0.dev
* Point CORE_REPO_SHA to opentelemetrybot/update-version-to-1.33.0.dev-0.54b0.dev
---------
Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
* botocore: add some more content to the README
This is taken from __init__.py documentation.
* Move the content to the README since it's not really code specific
* Add link to examples
* Apply suggestions from code review
Co-authored-by: Emídio Neto <9735060+emdneto@users.noreply.github.com>
---------
Co-authored-by: Emídio Neto <9735060+emdneto@users.noreply.github.com>
* botocore: test invokemodel tool calls against amazon nova
* botocore: handle amazon nova tool calls events for InvokeModelWithResponseStream
* Update documentation
* Update Changelog
* Please pylint
* Cleanup
* Reduce branches in tool calls tests
Instead pass down a per-model object that implements the peculiar part.
And fix recording of amazon.nova stream no content test.
* Move stream content extraction for tool calls tests to a couple of helpers
* Create per-extension tracers if there's an extension available
* botocore: add user events for bedrock
* Remove pass of AWS env vars from tox.ini
* Remove handling for other types of messages
* Please pylint
* Add changelog
* Update CHANGELOG.md
Co-authored-by: Adrian Cole <64215+codefromthecrypt@users.noreply.github.com>
---------
Co-authored-by: Adrian Cole <64215+codefromthecrypt@users.noreply.github.com>
* Add basic handling for invoke.model
* Add changelog a please pylint
* Record converse cassettes against us-east-1
* Avoid double copy of streaming body
---------
Co-authored-by: Adrian Cole <64215+codefromthecrypt@users.noreply.github.com>
* botocore: add extension for bedrock runtime api
* Add tests and handle only non streaming responses
* Make it explicit we are handling only the converse operation
* Simplify test since all models behaves the same
* Add test for error case and rework things a bit
* Add converse example
* Generate workflows
* Add changelog
Add "Repository" label to project urls pointing to the
opentelemetry-python repo root url.
Having within project urls one entry with the same value for all
packages released by the project will help tools for automatic
dependency management to suggest coherent upgrades for related packages.
* Added deb to make cassandra tests work with python 3.13
* Bumped cffi to work with Python 3.13
* Fixed some test-requirements for Python 3.13
* Updated typing_extensions everywhere
---------
Co-authored-by: Emídio Neto <9735060+emdneto@users.noreply.github.com>
* Update version to 1.27.0.dev/0.48b0.dev
* Update SHA and fix test cases
* Update SHA
---------
Co-authored-by: Diego Hurtado <ocelotl@users.noreply.github.com>
* requirements: bump zipp to 3.19.2
To resolve a dependabot securiy report.
* requirements: bump certifi to 2024.7.4
To resolve a dependabot security report.
* Remove unnecessary dependencies
Fixes#2661
* Separate runs
* Remove dev-requirements from test environment
* Try without negative if
* Remove positive if
* Remove if
* Separate benchmark-containing packages in another file
* Add missing test-requirements.txt file