mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-05-06 01:32:36 +00:00
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:
@@ -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"""
|
||||
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user