You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When combining langchain & langchain_community & langchain_aws the dd-trace library
Then the call to bedrock which is wrapped in the patched_bedrock_api_call method is broken
without the dd_trace library my code works fine
Reproduction Code
import all 3 modules
run the invoke method from the packgge: langchain_aws
either
prompt = ChatPromptTemplate.from_template(prompt_template)
[ERROR] 2025-01-07T06:33:00.060Z 9adfd63f-5ae2-48eb-9b58-94aa8da56738 Error raised by bedrock service: too many values to unpack (expected 2)
full stacktrace:
2025-01-07T06:33:00.074Z
File "/var/task/common_lib/langchain_utils.py", line 97, in extract_information
2025-01-07T06:33:00.074Z
response = chain.invoke(params)
2025-01-07T06:33:00.074Z
File "./python/lib/python3.9/site-packages/ddtrace/contrib/trace_utils.py", line 335, in wrapper
2025-01-07T06:33:00.074Z
File "./python/lib/python3.9/site-packages/ddtrace/contrib/langchain/patch.py", line 771, in traced_lcel_runnable_sequence
File "./python/lib/python3.9/site-packages/ddtrace/contrib/langchain/patch.py", line 771, in traced_lcel_runnable_sequence
2025-01-07T06:33:00.074Z
File "/opt/python/langchain_core/runnables/base.py", line 3022, in invoke
2025-01-07T06:33:00.074Z
input = context.run(step.invoke, input, config)
2025-01-07T06:33:00.074Z
File "/opt/python/langchain_core/language_models/chat_models.py", line 286, in invoke
2025-01-07T06:33:00.074Z
self.generate_prompt(
2025-01-07T06:33:00.074Z
File "/opt/python/langchain_core/language_models/chat_models.py", line 786, in generate_prompt
2025-01-07T06:33:00.074Z
return self.generate(prompt_messages, stop=stop, callbacks=callbacks, **kwargs)
2025-01-07T06:33:00.074Z
File "./python/lib/python3.9/site-packages/ddtrace/contrib/trace_utils.py", line 335, in wrapper
2025-01-07T06:33:00.074Z
File "./python/lib/python3.9/site-packages/ddtrace/contrib/langchain/patch.py", line 392, in traced_chat_model_generate
2025-01-07T06:33:00.074Z
File "/opt/python/langchain_core/language_models/chat_models.py", line 643, in generate
2025-01-07T06:33:00.074Z
raise e
2025-01-07T06:33:00.074Z
File "/opt/python/langchain_core/language_models/chat_models.py", line 633, in generate
2025-01-07T06:33:00.074Z
self._generate_with_cache(
2025-01-07T06:33:00.074Z
File "/opt/python/langchain_core/language_models/chat_models.py", line 851, in _generate_with_cache
2025-01-07T06:33:00.074Z
result = self._generate(
2025-01-07T06:33:00.074Z
File "/opt/python/langchain_aws/chat_models/bedrock.py", line 561, in _generate
2025-01-07T06:33:00.074Z
completion, tool_calls, llm_output = self._prepare_input_and_invoke(
2025-01-07T06:33:00.074Z
File "/opt/python/langchain_aws/llms/bedrock.py", line 841, in _prepare_input_and_invoke
2025-01-07T06:33:00.074Z
raise e
2025-01-07T06:33:00.074Z
File "/opt/python/langchain_aws/llms/bedrock.py", line 827, in _prepare_input_and_invoke
2025-01-07T06:33:00.074Z
response = self.client.invoke_model(**request_options)
2025-01-07T06:33:00.074Z
File "/opt/python/botocore/client.py", line 569, in _api_call
2025-01-07T06:33:00.074Z
return self._make_api_call(operation_name, kwargs)
2025-01-07T06:33:00.074Z
File "./python/lib/python3.9/site-packages/ddtrace/contrib/trace_utils.py", line 335, in wrapper
2025-01-07T06:33:00.074Z
File "./python/lib/python3.9/site-packages/ddtrace/contrib/botocore/patch.py", line 158, in patched_api_call
2025-01-07T06:33:00.074Z
File "./python/lib/python3.9/site-packages/ddtrace/contrib/botocore/services/bedrock.py", line 321, in patched_bedrock_api_call
File "./python/lib/python3.9/site-packages/ddtrace/contrib/botocore/services/bedrock.py", line 321, in patched_bedrock_api_call
2025-01-07T06:33:00.074Z
ValueError: too many values to unpack (expected 2)
Libraries in Use
langchain langchain_community langchain_aws
Operating System
running on lambda
The text was updated successfully, but these errors were encountered:
Tracer Version(s)
2.18.1
Python Version(s)
3.9.15
Pip Version(s)
24.3.1
Bug Report
When combining
langchain
&langchain_community
&langchain_aws
thedd-trace
libraryThen the call to bedrock which is wrapped in the
patched_bedrock_api_call
method is brokenwithout the dd_trace library my code works fine
Reproduction Code
import all 3 modules
run the invoke method from the packgge:
langchain_aws
either
prompt = ChatPromptTemplate.from_template(prompt_template)
Error Logs
[ERROR] 2025-01-07T06:33:00.060Z 9adfd63f-5ae2-48eb-9b58-94aa8da56738 Error raised by bedrock service: too many values to unpack (expected 2)
full stacktrace:
Libraries in Use
langchain
langchain_community
langchain_aws
Operating System
running on lambda
The text was updated successfully, but these errors were encountered: