INNER CODE UNIT · Python

main

Arthur-Ficial/apfel · mcp/calculator/test_round_trip.py:60

def main():
    print(f"Question: {QUESTION}")
    print()

    # Step 1: Ask apfel with calculator tool
    step1 = httpx.post(f"{BASE}/v1/chat/completions", json={
        "model": "apple-foundationmodel",
        "messages": [{"role": "user", "content": QUESTION}],
        "tools": TOOLS
    }, timeout=60).json()

    finish = step1["choices"][0]["finish_reason"]
    if finish != "tool_calls":
        content = step1["choices"][0]["message"].get("content", "")
        print(f"Model answered directly (no tool call): {content}")
        return

    tool_call = step1["choices"][0]["message"]["tool_calls"][0]

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…