Source code for tooluniverse.tools.ToolImplementationGenerator
"""
ToolImplementationGenerator
Generates domain-specific, functional code implementations based on tool descriptions and require...
"""
from typing import Any, Optional, Callable
from ._shared_client import get_shared_client
[docs]
def ToolImplementationGenerator(
tool_description: str,
tool_parameters: str,
domain: Optional[str] = "general",
complexity_level: Optional[str] = "intermediate",
performance_requirements: Optional[str] = None,
*,
stream_callback: Optional[Callable[[str], None]] = None,
use_cache: bool = False,
validate: bool = True,
) -> Any:
"""
Generates domain-specific, functional code implementations based on tool descriptions and require...
Parameters
----------
tool_description : str
Detailed description of what the tool should accomplish
tool_parameters : str
JSON string of parameter schema for the tool
domain : str
Domain area for specialized implementation
complexity_level : str
Desired complexity level of implementation
performance_requirements : str
Performance requirements or constraints
stream_callback : Callable, optional
Callback for streaming output
use_cache : bool, default False
Enable caching
validate : bool, default True
Validate parameters
Returns
-------
Any
"""
# Handle mutable defaults to avoid B006 linting error
return get_shared_client().run_one_function(
{
"name": "ToolImplementationGenerator",
"arguments": {
"tool_description": tool_description,
"tool_parameters": tool_parameters,
"domain": domain,
"complexity_level": complexity_level,
"performance_requirements": performance_requirements,
},
},
stream_callback=stream_callback,
use_cache=use_cache,
validate=validate,
)
__all__ = ["ToolImplementationGenerator"]