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

ERROR:openinference.instrumentation.langchain._tracer:Failed to get attribute #3120

Open
cmosguy opened this issue May 8, 2024 · 3 comments
Labels
bug Something isn't working needs information Needs more info from the issuer

Comments

@cmosguy
Copy link

cmosguy commented May 8, 2024

I am doing simple langchain and langgraph stuff.

import phoenix as px
from phoenix.trace.langchain import LangChainInstrumentor
px.launch_app()
LangChainInstrumentor().instrument()

run my workflow here

When I run the my langgraph workflow, I see:

ERROR:openinference.instrumentation.langchain._tracer:Failed to get attribute.
Traceback (most recent call last):
  File "/opt/miniconda3/envs/proj/lib/python3.10/site-packages/openinference/instrumentation/langchain/_tracer.py", line 236, in wrapper
    yield from wrapped(*args, **kwargs)
  File "/opt/miniconda3/envs/proj/lib/python3.10/site-packages/openinference/instrumentation/langchain/_tracer.py", line 325, in _input_messages
    assert hasattr(message_data, "get"), f"expected Mapping, found {type(message_data)}"
AssertionError: expected Mapping, found <class 'tuple'>
ERROR:openinference.instrumentation.langchain._tracer:Failed to get attribute.
Traceback (most recent call last):
  File "/opt/miniconda3/envs/proj/lib/python3.10/site-packages/openinference/instrumentation/langchain/_tracer.py", line 236, in wrapper
    yield from wrapped(*args, **kwargs)
  File "/opt/miniconda3/envs/proj/lib/python3.10/site-packages/openinference/instrumentation/langchain/_tracer.py", line 325, in _input_messages
    assert hasattr(message_data, "get"), f"expected Mapping, found {type(message_data)}"
AssertionError: expected Mapping, found <class 'tuple'>

I am using versions:

arize-phoenix==3.23.0
openinference-instrumentation==0.1.1
openinference-instrumentation-langchain==0.1.14
openinference-instrumentation-llama-index==1.2.1
openinference-instrumentation-openai==0.1.4
openinference-semantic-conventions==0.1.5
opentelemetry-api==1.24.0
opentelemetry-exporter-otlp==1.24.0
opentelemetry-exporter-otlp-proto-common==1.24.0
opentelemetry-exporter-otlp-proto-grpc==1.24.0
opentelemetry-exporter-otlp-proto-http==1.24.0
opentelemetry-instrumentation==0.45b0
opentelemetry-instrumentation-asgi==0.45b0
opentelemetry-instrumentation-fastapi==0.45b0
opentelemetry-proto==1.24.0
opentelemetry-sdk==1.24.0
opentelemetry-semantic-conventions==0.45b0
opentelemetry-util-http==0.45b0
langchain==0.1.16
langchain-community==0.0.33
langchain-core==0.1.48
langchain-openai==0.1.4
langchain-text-splitters==0.0.1
langchainhub==0.1.15
openinference-instrumentation-langchain==0.1.14
@cmosguy cmosguy added bug Something isn't working triage issues that need triage labels May 8, 2024
Copy link

dosubot bot commented May 8, 2024

The error "AssertionError: expected Mapping, found <class 'tuple'>" indicates that a tuple is being passed where a mapping (like a dictionary) is expected, specifically in the openinference/instrumentation/langchain/_tracer.py file. This issue likely arises from how data is being passed or expected within your workflow, particularly in relation to the LangChainInstrumentor or the OpenTelemetry configuration.

To address this, ensure that all interactions with the LangChainInstrumentor and any related OpenTelemetry configurations are correctly handling data types, especially where mappings are expected instead of tuples. Review any custom code or overrides that might be altering the expected data types or structures being passed to these components.

If the problem continues, providing more details about how you're using the LangChainInstrumentor in your workflow, including any custom configurations or interactions with OpenTelemetry components, would be helpful for further diagnosis.

Details

Sources


About Dosu
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

To continue the conversation, mention @dosu.

@dosubot dosubot bot added the c/traces label May 8, 2024
@axiomofjoy axiomofjoy self-assigned this May 8, 2024
@axiomofjoy
Copy link
Contributor

Thanks for reporting @cmosguy. Can you send a snippet of the LangChain code to reproduce?

@axiomofjoy
Copy link
Contributor

@cmosguy I am not able to reproduce the issue on the notebook link you sent. I am able to get traces from this notebook into Phoenix. Here's a link to a slightly modified version that is working for me. https://colab.research.google.com/drive/1xDEPe2i_2rRqs7o6oNTtqA4J7Orsnvx1?usp=sharing

Here are some relevant requirements.

arize-phoenix==4.0.0
langchain==0.1.19
langchain-core==0.1.52
langchain-experimental==0.0.58
langchain-openai==0.1.6
langgraph==0.0.48
openai==1.27.0
openinference-instrumentation==0.1.5
openinference-instrumentation-langchain==0.1.14
openinference-instrumentation-openai==0.1.4
opentelemetry-api==1.24.0
opentelemetry-exporter-otlp==1.24.0
opentelemetry-exporter-otlp-proto-common==1.24.0
opentelemetry-exporter-otlp-proto-grpc==1.24.0
opentelemetry-exporter-otlp-proto-http==1.24.0
opentelemetry-instrumentation==0.45b0
opentelemetry-proto==1.24.0
opentelemetry-sdk==1.24.0
opentelemetry-semantic-conventions==0.45b0

@axiomofjoy axiomofjoy added needs information Needs more info from the issuer and removed triage issues that need triage labels May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs information Needs more info from the issuer
Projects
Status: 📘 Todo
Development

No branches or pull requests

2 participants