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

[BUG] Invalid type warnings/errors on OTEL tracing example #476

Open
ismael-dm opened this issue Feb 3, 2025 · 3 comments
Open

[BUG] Invalid type warnings/errors on OTEL tracing example #476

ismael-dm opened this issue Feb 3, 2025 · 3 comments
Labels
bug Something isn't working

Comments

@ismael-dm
Copy link

Describe the bug
I´m trying the example described here and warnings of "Invalid type" are appearing constantly on the terminal.

Code to reproduce the error

from smolagents import (
    CodeAgent,
    ToolCallingAgent,
    ManagedAgent,
    DuckDuckGoSearchTool,
    VisitWebpageTool,
    OpenAIServerModel,
)
from opentelemetry import trace
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import BatchSpanProcessor

from openinference.instrumentation.smolagents import SmolagentsInstrumentor
from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
from opentelemetry.sdk.trace.export import ConsoleSpanExporter, SimpleSpanProcessor

endpoint = "http://localhost:6006/v1/traces"
trace_provider = TracerProvider()
trace_provider.add_span_processor(SimpleSpanProcessor(OTLPSpanExporter(endpoint)))

SmolagentsInstrumentor().instrument(tracer_provider=trace_provider)

model = OpenAIServerModel(
    model_id="meta-llama/Llama-3.3-70B-Instruct",
    api_key="-",
    api_base="http://localhost:10000/v1",
)

agent = ToolCallingAgent(
    tools=[DuckDuckGoSearchTool(), VisitWebpageTool()],
    model=model,
)
managed_agent = ManagedAgent(
    agent=agent,
    name="managed_agent",
    description="This is an agent that can do web search.",
)
manager_agent = CodeAgent(
    tools=[],
    model=model,
    managed_agents=[managed_agent],
)
manager_agent.run(
    "If the US keeps its 2024 growth rate, how many years will it take for the GDP to double?"
)

Error logs (if any)

━━━━━━━━━━━━━━━━━━━━━ Step 1 ━━━━━━━━━━━━━━━━━
Invalid type dict in attribute 'llm.input_messages.0.message.content' value sequence. 
Expected one of ['bool', 'str', 'bytes', 'int', 'float'] or None
Invalid type dict in attribute 'llm.input_messages.1.message.content' value sequence. 
Expected one of ['bool', 'str', 'bytes', 'int', 'float'] or None
Invalid type dict in attribute 'llm.input_messages.2.message.content' value sequence. 
Expected one of ['bool', 'str', 'bytes', 'int', 'float'] or None

Expected behavior
No warnings or errors

Packages version:
smolagents 1.7.0

Additional context
No additional context

@ismael-dm ismael-dm added the bug Something isn't working label Feb 3, 2025
@albertvillanova
Copy link
Member

Thanks for reporting, @ismael-dm.

I think this is an issue in openinference-instrumentation-smolagents.

@albertvillanova
Copy link
Member

Reported:

@nate-mar
Copy link

nate-mar commented Feb 6, 2025

This should be resolved now. Feel free to verify and close!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants