Annotations

Reference for client.annotations in the Future AGI Python and TypeScript SDKs: annotations.bulk_create, annotations.labels.create, annotations.labels.delete, annotations.labels.get, annotations.labels.list.

client.annotations on fi.Client (Python) and client.annotations on Client from @future-agi/sdk (TypeScript), with the nested resources client.annotations.labels. The models these methods return are on Annotation response models; how arguments, pagination, errors and strict mode work is in the overview.

Methods

MethodDescription
annotations.bulk_createCreate or update annotations and notes on spans in bulk.
annotations.labels.createCreate an annotation label (text, label, score, …) with its settings.
annotations.labels.deleteDelete (archive) an annotation label.
annotations.labels.getReturn an annotation label by id.
annotations.labels.listList annotation labels, optionally filtered by project, type or search text.

client.annotations

annotations.bulk_create

Create or update annotations and notes on spans in bulk.

POST /tracer/bulk-annotation/
result = client.annotations.bulk_create(records=[])
const result = await client.annotations.bulkCreate({ records: [] });
Signature
client.annotations.bulk_create(
    *,
    records: list[dict[str, Any]],
    extra_query: dict[str, Any] | None = None,
    extra_body: dict[str, Any] | None = None,
    options: RequestOptions | None = None,
) -> models.BulkAnnotationResponseResult
client.annotations.bulkCreate(params: AnnotationsBulkCreateParams, options?: RequestOptions): Promise<models.BulkAnnotationResponseResult>

export interface AnnotationsBulkCreateParams {
  records: Array<Record<string, unknown>>;
}

Parameters

records object[] Required

Returns

BulkAnnotationResponseResult.

client.annotations.labels

TypeScript: client.annotations.labels.

annotations.labels.create

Create an annotation label (text, label, score, …) with its settings.

POST /model-hub/annotations-labels/
result = client.annotations.labels.create(name="your-name", type="text")
const result = await client.annotations.labels.create({
  name: "your-name",
  type: "text",
});
Signature
client.annotations.labels.create(
    *,
    name: str,
    type: Literal['text', 'numeric', 'categorical', 'star', 'thumbs_up_down'],
    settings: dict[str, Any] | None | NotGiven = NOT_GIVEN,
    project: str | None | NotGiven = NOT_GIVEN,
    description: str | None | NotGiven = NOT_GIVEN,
    allow_notes: bool | None | NotGiven = NOT_GIVEN,
    extra_query: dict[str, Any] | None = None,
    extra_body: dict[str, Any] | None = None,
    options: RequestOptions | None = None,
) -> models.AnnotationsLabels
client.annotations.labels.create(params: AnnotationsLabelsCreateParams, options?: RequestOptions): Promise<models.AnnotationsLabels>

export interface AnnotationsLabelsCreateParams {
  name: string;
  type: "text" | "numeric" | "categorical" | "star" | "thumbs_up_down";
  settings?: Record<string, unknown> | null;
  project?: string | null;
  description?: string | null;
  allow_notes?: boolean | null;
}

Parameters

name string Required
type string Required
Allowed values:
textnumericcategoricalstarthumbs_up_down
settings object Optional
project string Optional
description string Optional
allow_notes boolean Optional

Returns

AnnotationsLabels.

annotations.labels.delete

Delete (archive) an annotation label.

DELETE /model-hub/annotations-labels/{id}/
result = client.annotations.labels.delete("your-id")
const result = await client.annotations.labels.delete("your-id");
Signature
client.annotations.labels.delete(
    id: str,
    *,
    extra_query: dict[str, Any] | None = None,
    extra_body: dict[str, Any] | None = None,
    options: RequestOptions | None = None,
) -> Any
client.annotations.labels.delete(id: string, options?: RequestOptions): Promise<unknown>

Parameters

id string Required

Positional argument id.

Returns

The decoded response. The contract does not describe its shape, so it is untyped.

annotations.labels.get

Return an annotation label by id.

GET /model-hub/annotations-labels/{id}/
result = client.annotations.labels.get("your-id")
const result = await client.annotations.labels.get("your-id");
Signature
client.annotations.labels.get(
    id: str,
    *,
    extra_query: dict[str, Any] | None = None,
    options: RequestOptions | None = None,
) -> models.AnnotationsLabels
client.annotations.labels.get(id: string, options?: RequestOptions): Promise<models.AnnotationsLabels>

Parameters

id string Required

Positional argument id.

Returns

AnnotationsLabels.

annotations.labels.list

List annotation labels, optionally filtered by project, type or search text.

GET /model-hub/annotations-labels/

Paginated: returns a pager (how pagination works)

for item in client.annotations.labels.list():
    print(item)
for await (const item of client.annotations.labels.list()) {
  console.log(item);
}
Signature
client.annotations.labels.list(
    *,
    limit: int | None | NotGiven = NOT_GIVEN,
    dataset: str | None | NotGiven = NOT_GIVEN,
    project_id: str | None | NotGiven = NOT_GIVEN,
    type: Literal['text', 'numeric', 'categorical', 'star', 'thumbs_up_down'] | None | NotGiven = NOT_GIVEN,
    search: str | None | NotGiven = NOT_GIVEN,
    include_usage_count: bool | None | NotGiven = NOT_GIVEN,
    include_archived: bool | None | NotGiven = NOT_GIVEN,
    archived: bool | None | NotGiven = NOT_GIVEN,
    extra_query: dict[str, Any] | None = None,
    options: RequestOptions | None = None,
) -> SyncPager[models.AnnotationsLabels]
client.annotations.labels.list(params: AnnotationsLabelsListParams = {}, options?: RequestOptions): Pager<models.AnnotationsLabels>

export interface AnnotationsLabelsListParams {
  /** Number of results to return per page. */
  limit?: number | null;
  dataset?: string | null;
  project_id?: string | null;
  type?: "text" | "numeric" | "categorical" | "star" | "thumbs_up_down" | null;
  search?: string | null;
  include_usage_count?: boolean | null;
  include_archived?: boolean | null;
  archived?: boolean | null;
}

Parameters

limit integer Optional

Number of results to return per page.

dataset string Optional
project_id string Optional
type string Optional
Allowed values:
textnumericcategoricalstarthumbs_up_down
search string Optional
include_usage_count boolean Optional
include_archived boolean Optional
archived boolean Optional

The pager sends page itself; pass limit to change the page size.

Returns

A pager of AnnotationsLabels items: iterate it, or call to_list() (Python) / toArray() (TypeScript).

Was this page helpful?

Questions & Discussion