MCPcopy Create free account
hub / github.com/Paper2Poster/Paper2Poster / get_openai_function_schema

Function get_openai_function_schema

camel/toolkits/function_tool.py:70–87  ·  view source on GitHub ↗

r"""Generates a schema dict for an OpenAI function based on its signature. This function is deprecated and will be replaced by :obj:`get_openai_tool_schema()` in future versions. It parses the function's parameters and docstring to construct a JSON schema-like dictionary. Args:

(func: Callable)

Source from the content-addressed store, hash-verified

68
69
70def get_openai_function_schema(func: Callable) -> Dict[str, Any]:
71 r"""Generates a schema dict for an OpenAI function based on its signature.
72
73 This function is deprecated and will be replaced by
74 :obj:`get_openai_tool_schema()` in future versions. It parses the
75 function's parameters and docstring to construct a JSON schema-like
76 dictionary.
77
78 Args:
79 func (Callable): The OpenAI function to generate the schema for.
80
81 Returns:
82 Dict[str, Any]: A dictionary representing the JSON schema of the
83 function, including its name, description, and parameter
84 specifications.
85 """
86 openai_function_schema = get_openai_tool_schema(func)["function"]
87 return openai_function_schema
88
89
90def get_openai_tool_schema(func: Callable) -> Dict[str, Any]:

Callers

nothing calls this directly

Calls 1

get_openai_tool_schemaFunction · 0.70

Tested by

no test coverage detected