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

Invalid type error on every message #333

Open
morigs opened this issue Jan 23, 2025 · 2 comments
Open

Invalid type error on every message #333

morigs opened this issue Jan 23, 2025 · 2 comments

Comments

@morigs
Copy link

morigs commented Jan 23, 2025

With simplest example using CodeAgent I'm getting the following error on every agent message:

Invalid type ChatMessage for attribute 'output.value' value. Expected one of ['bool', 'str', 'bytes', 'int', 'float'] or a sequence of those types
model_id = environ.get("MODEL_ID", "meta-llama/Llama-3.3-70B-Instruct")
model = HfApiModel(model_id=model_id, timeout=60)

if __name__ == "__main__":
    agent = CodeAgent(
        tools=[],
        model=model
    )
    agent.run(input("ASK:"))

Python 3.12.8
smolagents v1.4.1

@touseefahmed96
Copy link
Contributor

Try to reinstall smolagents because your code is working :

ASK:2+2
╭─────────────────────────────────────────────────────────────────────────────────────────────────── New run ───────────────────────────────────────────────────────────────────────────────────────────────────╮
│                                                                                                                                                                                                               │
│ 2+2                                                                                                                                                                                                           │
│                                                                                                                                                                                                               │
╰─ HfApiModel - Qwen/Qwen2.5-Coder-32B-Instruct ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Step 0 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 ─ Executing this code: ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── 
  result = 2 + 2                                                                                                                                                                                                 
  final_answer(result)                                                                                                                                                                                           
 ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── 
Out - Final answer: 4

@morigs
Copy link
Author

morigs commented Jan 23, 2025

My bad, I've completely omitted the imports but the important line was there... I was importing telemetry file which does the following:

from opentelemetry.sdk.trace import TracerProvider
from os import environ
from openinference.instrumentation.smolagents import SmolagentsInstrumentor
from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
from opentelemetry.sdk.trace.export import SimpleSpanProcessor

endpoint = environ.get("OTLP_SPAN_EXPORTER_ENDPOINT", "http://127.0.0.1:6006/v1/traces")
trace_provider = TracerProvider()
trace_provider.add_span_processor(SimpleSpanProcessor(OTLPSpanExporter(endpoint)))
SmolagentsInstrumentor().instrument(tracer_provider=trace_provider)

I can confirm that the message stops appearing after disabling tracing.

├── openinference-instrumentation-smolagents v0.1.0
├── opentelemetry-exporter-otlp v1.29.0
├── opentelemetry-sdk v1.29.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants