gen_ai_hub.orchestration.models.tools
index
/home/jenkins/agent/workspace/ation_generative-ai-hub-sdk_main/gen_ai_hub/orchestration/models/tools.py

 
Modules
       
inspect
typing

 
Classes
       
gen_ai_hub.orchestration.models.base.JSONSerializable(abc.ABC)
ChatCompletionTool
FunctionTool

 
class ChatCompletionTool(gen_ai_hub.orchestration.models.base.JSONSerializable)
    ChatCompletionTool(type_: str)
 
Base class for all chat completion tools.
 
 
Method resolution order:
ChatCompletionTool
gen_ai_hub.orchestration.models.base.JSONSerializable
abc.ABC
builtins.object

Methods defined here:
__init__(self, type_: str)
Initialize self.  See help(type(self)) for accurate signature.
to_dict(self) -> Dict[str, Any]
Convert the object to a JSON-serializable dictionary.

Data and other attributes defined here:
__abstractmethods__ = frozenset()
__annotations__ = {}

Data descriptors inherited from gen_ai_hub.orchestration.models.base.JSONSerializable:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class FunctionTool(ChatCompletionTool)
    FunctionTool(name: str, parameters: dict, strict: bool = False, description: Optional[str] = None, function: Optional[Callable] = None)
 
Represents a function tool for OpenAI-like function calling.
 
 
Method resolution order:
FunctionTool
ChatCompletionTool
gen_ai_hub.orchestration.models.base.JSONSerializable
abc.ABC
builtins.object

Methods defined here:
__init__(self, name: str, parameters: dict, strict: bool = False, description: Optional[str] = None, function: Optional[Callable] = None)
Initialize self.  See help(type(self)) for accurate signature.
async aexecute(self, **kwargs: Any) -> Any
Asynchronously execute the function with the provided arguments.
execute(self, **kwargs: Any) -> Any
Execute the function with the provided arguments.
to_dict(self) -> Dict[str, Any]
Convert the object to a JSON-serializable dictionary.

Static methods defined here:
from_function(func: Callable, *, description: Optional[str] = None, strict: bool = False) -> 'FunctionTool'
Create a FunctionTool from a Python function.

Data and other attributes defined here:
__abstractmethods__ = frozenset()
__annotations__ = {}

Data descriptors inherited from gen_ai_hub.orchestration.models.base.JSONSerializable:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
Functions
       
function_tool(func: Optional[Callable] = None, *, description: Optional[str] = None, strict: bool = False) -> Union[Callable[[Callable], gen_ai_hub.orchestration.models.tools.FunctionTool], gen_ai_hub.orchestration.models.tools.FunctionTool]
Decorator that converts a function into a FunctionTool.
Usage:
    @function_tool
    def my_func(...): ...
 
    @function_tool()
    def my_func(...): ...
python_type_to_json_type(py_type)

 
Data
        Any = typing.Any
Callable = typing.Callable
Dict = typing.Dict
Optional = typing.Optional