INNER CODE UNIT · Python

list_tools

skyportal/skyportal · services/assistant/app.py:126

def list_tools(token, context_type=None):
    """The tools to offer, as the chat API wants them."""
    tools = offered_tools(_rpc(token, "tools/list", {}, 60)["tools"], context_type)
    return [
        {
            "type": "function",
            "function": {
                "name": tool["name"],
                "description": tool.get("description", ""),
                "parameters": tool.get("inputSchema", {"type": "object"}),
            },
        }
        for tool in tools
    ]


def call_tool(token, name, arguments, offered, context_id=None):
    """Run one tool, refusing any that was not offered.

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…