Framework for orchestrating role-playing, autonomous AI agents. By fostering collaborative intelligence, CrewAI empowers agents to work together seamlessly, tackling complex tasks.
I have a custom tool using the langchain StructuredTool.from_function
from langchain.tools.base import StructuredTool
from langchain_core.pydantic_v1 import BaseModel, Field
create_draft_tool = StructuredTool.from_function(
func=create_draft,
name="Create Draft",
description="""
Create an email draft. Ensure to pass input as a valid JSON.
Only pass in a JSON object. Do not pass in any markdown string anywhere.
""",
args_schema=DraftInput,
return_direct=True
)
where DraftInput is a Pydantic class (fields excluded)
class DraftInput(BaseModel):
to: str = Field(
...,
description="Who to send the email to",
alias="to"
)
but when the tool is called, it passes in the correct JSON but inside a markdown string like so:
I have a custom tool using the langchain StructuredTool.from_function
where DraftInput is a Pydantic class (fields excluded)
but when the tool is called, it passes in the correct JSON but inside a markdown string like so:
and so the tool fails with the error
Task output: Error: the Action Input is not a valid key, value dictionary.
How can I force it to just input the JSON object and not inside the markdown string.
langchain~=0.2.6
crewai==0.36.0