Downloads

SDKs and clients to easily interact with the iDEF Geometry API

⚠️

Important: Problem Format for GIVEN/GOAL

When using the structured GIVEN/GOAL format, each statement must be on a separate line. Use \n to create line breaks in your API calls.

❌ WRONG (all on one line)
GIVEN: POINTS A,B,C EQLEN A B A C GOAL: EQANG A B C A C B
✓ CORRECT (each statement on new line)
GIVEN:
POINTS A,B,C
EQLEN A B A C
GOAL:
EQANG A B C A C B

How to format in different tools:

In Python (use triple quotes):

Python
problem = """GIVEN:
POINTS A,B,C
EQLEN A B A C
GOAL:
EQANG A B C A C B"""

In JSON (cURL): Use \n for line breaks:

JSON
"GIVEN:\nPOINTS A,B,C\nEQLEN A B A C\nGOAL:\nEQANG A B C A C B"

In Bash (using $'...' syntax):

Bash
$'GIVEN:\nPOINTS A,B,C\nEQLEN A B A C\nGOAL:\nEQANG A B C A C B'

Using a file (recommended for complex problems):

problem.txt
GIVEN:
POINTS A,B,C,D
EQLEN O A O B
EQLEN O B O C
GOAL:
EQANG A B C A D C

⚠️ Why this matters: The solver parses each line separately. If everything is on one line, it cannot understand your problem and will fail or give wrong results.

🐍

Python SDK

Official Python client with automatic polling. Works on Windows, macOS, and Linux.

⬇️ Download idef_geometry.py

Download the SDK

Click the download button above. The file will be saved to your Downloads folder.

Open Terminal and go to Downloads folder

Open your terminal (Command Prompt, PowerShell, or Git Bash on Windows; Terminal on macOS/Linux):

Windows (Git Bash / PowerShell)
cd "$HOME/Downloads"
macOS / Linux
cd ~/Downloads

Install the requests library

The SDK requires the requests library:

Terminal / Command Prompt
pip install requests

Create your script

Create a new file called test.py in the same folder (Downloads):

test.py
from idef_geometry import GeometryAPI

# Replace with your API key from https://idef-mathematics.com/api
api = GeometryAPI("gai_live_YOUR_API_KEY_HERE")

# Simple problem (natural language)
result = api.prove(
    "In triangle ABC, AB=AC. Prove angle ABC = angle ACB",
    model="A5"
)

print(f"Proved: {result.proved}")
print(result.proof_trace)

Run your script

Make sure you're still in the Downloads folder, then run:

Terminal / Command Prompt
python test.py

Using GIVEN/GOAL format in Python:

Python with multi-line problem
from idef_geometry import GeometryAPI

api = GeometryAPI("gai_live_YOUR_API_KEY")

# Use triple quotes for multi-line problems
problem = """GIVEN:
POINTS A,B,C
EQLEN A B A C
GOAL:
EQANG A B C A C B"""

result = api.prove(problem, model="A5")

print(f"Proved: {result.proved}")
print(result.proof_trace)

💡 Tip: Use Python's triple quotes ("""...""") to write multi-line problems naturally without \n. Always include print(result.proof_trace) to see the full proof output.

💻

Bash Client

Command-line tool for Linux, macOS, and Windows (Git Bash/WSL). Requires Python for JSON parsing.

⬇️ Download geometryai-client.sh

Download the client

Click the download button above. The file will be saved to your Downloads folder.

Open Terminal and go to Downloads folder

Windows (Git Bash)
cd "$HOME/Downloads"
macOS / Linux
cd ~/Downloads

Make it executable

Terminal
chmod +x geometryai-client.sh

Run it with a simple problem

Terminal
./geometryai-client.sh YOUR_API_KEY "In triangle ABC, AB=AC. Prove ABC=ACB"

Using GIVEN/GOAL format in Bash:

Option 1: Use $'...' syntax with \n

Bash with \n
./geometryai-client.sh YOUR_KEY $'GIVEN:\nPOINTS A,B,C\nEQLEN A B A C\nGOAL:\nEQANG A B C A C B'

Option 2: Use a problem file (recommended)

Create a file called problem.txt with your problem:

problem.txt
GIVEN:
POINTS A,B,C,D
EQLEN O A O B
EQLEN O B O C
GOAL:
EQANG A B C A D C

Then run:

Terminal
./geometryai-client.sh YOUR_KEY -f problem.txt A5

💡 Tip: Using -f problem.txt is the easiest way to handle complex multi-line problems. Just save your problem in a text file with proper line breaks.

🔗

Direct API (cURL)

Use cURL directly from any terminal. This is a two-step process.

Submit your problem

This returns a job_id that you'll use to get the result.

Simple problem:

Terminal
curl -X POST https://idef-mathematics.com/api/v1/problems \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"problem": "In triangle ABC, AB=AC. Prove angle ABC = angle ACB", "options": {"model": "A5"}}'

GIVEN/GOAL format (use \n for line breaks):

Terminal
curl -X POST https://idef-mathematics.com/api/v1/problems \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"problem": "GIVEN:\nPOINTS A,B,C\nEQLEN A B A C\nGOAL:\nEQANG A B C A C B", "options": {"model": "A5"}}'

Response:

{"job_id": "abc123def456", "status": "queued", "model": "A5"}

Get the result

Replace abc123def456 with your actual job_id. You may need to wait a few seconds and poll again if status is "processing":

Terminal
curl https://idef-mathematics.com/api/v1/jobs/abc123def456 \
  -H "Authorization: Bearer YOUR_API_KEY"

Response (when completed):

{
  "job_id": "abc123def456",
  "status": "completed",
  "result": {
    "proved": true,
    "proof_trace": "Step 1: Given AB = AC (isoceles)...",
    "computation_time": 1.24
  }
}

Note: If status is "processing" or "queued", wait 1-2 seconds and poll again. The Python SDK and Bash client handle this automatically.

📋

Quick Reference

Step Command
Go to Downloads cd "$HOME/Downloads"
Make script executable chmod +x geometryai-client.sh
Run Bash client ./geometryai-client.sh KEY "problem"
Run with file ./geometryai-client.sh KEY -f problem.txt
Run Python script python test.py
Use A6 model ./geometryai-client.sh KEY "problem" A6