feat: enhance LangGraphToolAdapter and improve conversion instructions

- Added type hints for better clarity and type checking in LangGraphToolAdapter.
- Updated conversion instructions to ensure compatibility with optional LLM checks.
This commit is contained in:
lorenzejay
2025-04-09 16:32:33 -07:00
parent 2cc5b0cb11
commit 55e0bdec18
2 changed files with 6 additions and 1 deletions

View File

@@ -1,3 +1,8 @@
from typing import Any, List, Optional
from crewai.tools.base_tool import BaseTool
class LangGraphToolAdapter:
"""Adapts CrewAI tools to LangGraph-compatible format"""

View File

@@ -216,7 +216,7 @@ def convert_with_instructions(
def get_conversion_instructions(model: Type[BaseModel], llm: Any) -> str:
instructions = "Please convert the following text into valid JSON."
if llm.supports_function_calling():
if llm and llm.supports_function_calling():
model_schema = PydanticSchemaParser(model=model).get_schema()
instructions += (
f"\n\nOutput ONLY the valid JSON and nothing else.\n\n"