Skip to content

Add estimate, aggregate, modify, and batch API endpoints#62

Merged
arauhala merged 3 commits into
masterfrom
feature/estimate-and-modify-endpoints
Dec 14, 2025
Merged

Add estimate, aggregate, modify, and batch API endpoints#62
arauhala merged 3 commits into
masterfrom
feature/estimate-and-modify-endpoints

Conversation

@arauhala
Copy link
Copy Markdown
Contributor

Summary

  • Add estimate() function for numeric value estimation using K-NN
  • Add aggregate() function for aggregated values (sum, avg, count, etc.)
  • Add modify() function for atomic data modifications with helper classes:
    • Insert: insert single or multiple entries
    • Update: update entries with fluent where().set().upsert() interface
    • Delete: delete entries matching a condition
  • Add batch() function for executing multiple queries in a single HTTP request
  • Add corresponding request/response classes for all new endpoints
  • Bump version to 0.5.2

Example usage

import aito.api as api
from aito.client.requests import Insert, Update, Delete

# Estimate numeric values
result = api.estimate(client, {
    "from": "products",
    "where": {"name": "rye bread"},
    "estimate": "price"
})

# Batch multiple queries
results = api.batch(client, [
    {"from": "products", "predict": "category", "where": {"name": "bread"}},
    {"from": "products", "similarity": {"name": "bread"}}
])

# Modify data with helper classes
api.modify(client, Insert("products", {"id": "1", "name": "Apple"}))
api.modify(client, Update("products").where({"id": "1"}).set({"name": "New Name"}))
api.modify(client, Delete("products", {"id": "1"}))

# Multiple atomic operations
api.modify(client, [
    Insert("products", {"id": "1", "name": "Apple"}),
    Update("products").where({"id": "2"}).set({"name": "Banana"})
])

Test plan

  • All existing SDK tests pass (193 tests)
  • Estimate endpoint tested with grocery demo
  • Batch endpoint tested with grocery demo
  • Modify helpers tested (Insert, Update, Delete)
  • Multiple modify operations tested

🤖 Generated with Claude Code

araufuturice and others added 3 commits December 14, 2025 11:31
- Add estimate() function for numeric value estimation using K-NN
- Add aggregate() function for aggregated values (sum, avg, count)
- Add modify() function for atomic data modifications with helper classes:
  - Insert: insert single or multiple entries
  - Update: update entries with fluent where().set().upsert() interface
  - Delete: delete entries matching a condition
- Add batch() function for executing multiple queries in a single request
- Add corresponding request/response classes for all new endpoints
- Bump version to 0.5.2

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Add :: to create proper code block
- Reformat multi-line examples to avoid indentation issues

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Add EstimateSubCommand and AggregateSubCommand to CLI
- Register commands in main_parser.py
- Fix typo: "execluding" -> "excluding" in CircleCI config

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@arauhala arauhala merged commit 1a664ea into master Dec 14, 2025
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants