Skip to content

[Bug]: Broken viz in Agent Ops Traces when using with_structured_outputΒ #1263

@pedrom-hd

Description

@pedrom-hd

Contact Details

No response

πŸ“¦ Package Version

agentops==0.4.21

🎞️ Framework Version

No response

πŸ”Ž Describe the Bug

    from agentops.integration.callbacks.langchain import LangchainCallbackHandler
    from langchain_openai import ChatOpenAI
    from src.settings import settings
    handler = LangchainCallbackHandler(api_key=settings.agentops_api_key, tags=['LangChain Example'])


    chat_model = ChatOpenAI(
        model_name="gpt-4o-2024-08-06",
        base_url="https://eu.api.openai.com/v1",
        api_key=settings.openai_api_key,
        temperature=0,
        callbacks=[handler],
    )
    
    llm_with_structured_output = chat_model.with_structured_output(Score)
    message_str = json.dumps(data, ensure_ascii=False)
    prompt = PROMPT.format(info=message_str)
    response = await llm_with_structured_output.ainvoke(prompt)
Image

🀝 Contribution

  • Yes, I'd be happy to submit a pull request with these changes.
  • I need some guidance on how to contribute.
  • I'd prefer the AgentOps team to handle this update.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions