Basic Calculator Functions

Let’s start off simple. While you wouldn’t typically use the API just for math, it clearly shows how Incredible can execute precise operations beyond plain text generation.
curl https://api.incredible.one/v1/chat-completion \
  --header "Content-Type: application/json" \
  --data '{
    "model": "small-1",
    "functions": [
      {
        "name": "calculate",
        "description": "Perform mathematical calculations with high precision",
        "parameters": {
          "type": "object",
          "properties": {
            "expression": {
              "type": "string",
              "description": "Mathematical expression to evaluate (e.g., '\''2 + 2'\'')"
            }
          },
          "required": ["expression"]
        }
      }
    ],
    "messages": [
      {
        "role": "user",
        "content": "Calculate the compound interest on $10,000 at 5% annual rate for 3 years"
      }
    ]
  }

Example Scenarios

  1. User: “What’s 25 × 4?”
    → AI calls calculate with expression="25 * 4"
    AI: “The answer is 100.”
  2. User: “What is (50 + 20) ÷ 7?”
    → AI calls calculate with expression="(50 + 20) / 7"
    AI: “The result is 10.”
  3. User: “Find the square root of 144.”
    → AI calls calculate with expression="sqrt(144)"
    AI: “The square root is 12.”
  4. User: “How much is 15% of 200?”
    → AI calls calculate with expression="200 * 0.15"
    AI: “The answer is 30.”