Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.galileo.ai/llms.txt

Use this file to discover all available pages before exploring further.

Module

Query result wrapper for easy data access and pagination.

QueryResult

A list-like wrapper for query results that provides easy access to records and pagination. This class makes it simple to work with query results by:
  • Providing list-like indexing and iteration (e.g., result[0], for record in result)
  • Flattening nested record structures into simple dictionaries
  • Exposing pagination metadata (limit, next_starting_token, paginated)
  • Offering a next_page() method to easily fetch subsequent pages
Examples
# Basic iteration
log_stream = LogStream.get(name="Production Logs", project_name="My AI Project")
result = log_stream.get_spans(limit=10)

for record in result:
    print(record["id"], record["input"])

# Index access
first_record = result[0]
print(first_record["created_at"])

# Pagination (in-place - extends the current result)
if result.has_next_page:
    result.next_page()
    print(f"Now have {len(result)} records after fetching next page")

# Pagination (with assignment - same object returned)
result = log_stream.get_spans(limit=10)
if result.has_next_page:
    result = result.next_page()
    for record in result:
        print(record["id"])

# Check pagination status
print(f"Total records in this page: {len(result)}")
print(f"Has next page: {result.has_next_page}")

has_next_page

def has_next_page(self) -> bool
Whether there is a next page available.

last_row_id

def last_row_id(self) -> str | None
The ID of the last row in this result set.

limit

def limit(self) -> int
The maximum number of records per page.

next_page

def next_page(self) -> QueryResult
Fetch the next page and extend current results. Examples
# In-place usage (mutates the result)
result = log_stream.get_spans(limit=10)
if result.has_next_page:
    result.next_page()
    print(f"Now have {len(result)} records")

# Assignment usage (same object, supports chaining)
result = log_stream.get_spans(limit=10)
if result.has_next_page:
    result = result.next_page()
    for record in result:
        print(record["id"])

next_starting_token

def next_starting_token(self) -> int | None
Token for fetching the next page, or None if this is the last page.

paginated

def paginated(self) -> bool
Whether pagination is enabled.

starting_token

def starting_token(self) -> int
The starting token used for this page.

to_list

def to_list(self) -> list[dict[str, Any]]
Convert the result to a plain list of dictionaries. Examples
result = log_stream.get_spans()
records_list = result.to_list()