Node.js

Our Node.js SDK provides a type-safe way to interact with the Avido API. You can install it using npm:

npm install avido

Basic Usage

import Avido from "avido";
const client = new Avido({
  bearerToken: process.env["BEARER_TOKEN"],
  environment: "production", // or 'environment_1'
});
async function main() {
  const evaluationCase = await client.evaluations.create({
    applicationId: "456e4567-e89b-12d3-a456-426614174000",
    evaluationCriteria:
      "The function should handle empty arrays, null values, and correctly sum all prices",
    factualCorrectness: true,
    styleRequirements: true,
    task: "Implement a function to calculate the total price of items in a shopping cart",
    topicId: "789e4567-e89b-12d3-a456-426614174000",
  });
  console.log(evaluationCase.data);
}

Python

Our Python SDK provides both synchronous and asynchronous clients for the Avido API. Install it using pip:

pip install avido

Basic Usage

import os
from avido import Avido
client = Avido(
bearer_token=os.environ.get("BEARER_TOKEN"),
environment="production" # defaults to "production"
)
webhook_validation_response = client.webhook.validate(
body={},
)
print(webhook_validation_response.valid)

Async Usage

python
import os
import asyncio
from avido import AsyncAvido
client = AsyncAvido(
bearer_token=os.environ.get("BEARER_TOKEN"),
environment="production"
)
async def main():
webhook_validation_response = await client.webhook.validate(
body={},
)
print(webhook_validation_response.valid)
asyncio.run(main())

Error Handling

Both SDKs provide consistent error handling with specific error types for different scenarios:

Status CodeError Type
400BadRequestError
401AuthenticationError
403PermissionDeniedError
404NotFoundError
422UnprocessableEntityError
429RateLimitError
≥500InternalServerError
N/AAPIConnectionError

Additional Features

Both SDKs include:

  • Full TypeScript/Python type definitions
  • Automatic retries with exponential backoff
  • Pagination helpers
  • Configurable timeouts
  • Detailed logging options
  • Customizable HTTP clients

For more detailed documentation, visit:

  • Node.js SDK: NPM
  • Python SDK: PyPI