LogStream
Log streams are used to organize logs within a project on the Galileo platform. They provide a way to categorize and group related logs, making it easier to analyze and monitor specific parts of your application or different environments (e.g., production, staging, development). Arguments-
created_at(datetime.datetime): The timestamp when the log stream was created. -
created_by(str): The identifier of the user who created the log stream. -
id(str): The unique identifier of the log stream. -
name(str): The name of the log stream. -
project_id(str): The ID of the project this log stream belongs to. -
updated_at(datetime.datetime): The timestamp when the log stream was last updated. -
additional_properties(dict): Additional properties associated with the log stream.
enable_metrics
-
metrics(builtins.list[Union[GalileoScorers, Metric, LocalMetricConfig, str]]): List of metrics to enable on this log stream. Supports multiple input formats:- GalileoScorers enum values: Built-in metrics like
GalileoScorers.correctness - Metric objects: Custom metrics with optional version specifications
- LocalMetricConfig objects: Client-side metrics with custom scoring functions
- String names: Built-in metric names like “correctness” or “toxicity”
- GalileoScorers enum values: Built-in metrics like
ValueError: - If this LogStream instance lacks requiredidorproject_idattributes- If any specified metrics are unknown or unavailable
- If there are issues with metric configuration or registration
GalileoHTTPException: If there are network or API errors when communicating with Galileo services
builtins.list[LocalMetricConfig]: List of local metric configurations that must be computed client-side. Server-side metrics are automatically registered with Galileo and don’t need to be returned since users don’t interact with them.
- The LogStream instance must have valid
idandproject_idattributes - These are automatically set when retrieving LogStream objects via LogStreams methods
- Use this method when you already have a LogStream object
- More intuitive than specifying project/log stream names again
- Cleaner object-oriented design pattern
LogStreams
create
project_id or project_name must be provided.
Arguments
name(str): The name of the log stream.project_id(Optional[str]): The ID of the project to create the log stream in. Defaults to None.project_name(Optional[str]): The name of the project to create the log stream in. Defaults to None.
ValueError: If neither or bothproject_idandproject_nameare provided, or if the project is not found.HTTPValidationError: If the server validation fails.errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.httpx.TimeoutException: If the request takes longer than Client.timeout.
LogStream: The created log stream.
enable_metrics
log_stream_name(Optional[str]): The name of the log stream. Takes precedence over the GALILEO_LOG_STREAM environment variable. Defaults to None.project_name(Optional[str]): The name of the project. Takes precedence over the GALILEO_PROJECT environment variable. Defaults to None.metrics(builtins.list[Union[GalileoScorers, Metric, LocalMetricConfig, str]]): List of metrics to enable. Can include:- GalileoScorers enum values (e.g., GalileoScorers.correctness)
- Metric objects with name and optional version
- LocalMetricConfig objects for custom local metrics
- String names of built-in metrics
ValueError: If log stream or project cannot be found, or if metrics are unknown.
tuple[builtins.list[ScorerConfig], builtins.list[LocalMetricConfig]]: A tuple containing the configured scorer configs and local metric configs.
get
id(Optional[str]): The id of the log stream. Defaults to None.name(Optional[str]): The name of the log stream. Defaults to None.project_id(Optional[str]): The ID of the project. Defaults to None.project_name(Optional[str]): The name of the project. Defaults to None.
ValueError: If neither or bothidandnameare provided, or if neither or bothproject_idandproject_nameare provided.errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.httpx.TimeoutException: If the request takes longer than Client.timeout.
Optional[LogStream]: The log stream if found, None otherwise.
list
project_id or project_name must be provided.
Arguments
project_id(Optional[str]): The ID of the project to list log streams for.project_name(Optional[str]): The name of the project to list log streams for.
ValueError: If neither or bothproject_idandproject_nameare provided.errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.httpx.TimeoutException: If the request takes longer than Client.timeout.
builtins.list[LogStream]: A list of log streams.
create_log_stream
project_id or project_name must be provided.
Arguments
name(str): The name of the log stream.
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.httpx.TimeoutException: If the request takes longer than Client.timeout.
LogStream: The created project.
enable_metrics
- Environment-only: Just pass metrics, names from env vars (production/CI)
- Explicit parameters: Specify project/log stream names directly (development)
- Mixed approach: Combine explicit params with environment fallbacks
Environment Variables (Optional Fallbacks)
GALILEO_PROJECT : str The name of the Galileo project (used when project_name not provided) GALILEO_LOG_STREAM : str The name of the log stream (used when log_stream_name not provided) Argumentslog_stream_name(Optional[str]): The name of the log stream. Takes precedence over GALILEO_LOG_STREAM environment variable. If None, will use GALILEO_LOG_STREAM env var. Defaults to None.project_name(Optional[str]): The name of the project. Takes precedence over GALILEO_PROJECT environment variable. If None, will use GALILEO_PROJECT env var. Defaults to None.metrics(builtins.list[Union[GalileoScorers, Metric, LocalMetricConfig, str]]): List of metrics to enable on the log stream. Can include:- GalileoScorers enum values (e.g., GalileoScorers.correctness)
- Metric objects with name and optional version for custom metrics
- LocalMetricConfig objects for client-side custom scoring functions
- String names of built-in metrics (e.g., “correctness”, “toxicity”)
ValueError: If log stream or project cannot be found, or if any specified metrics are unknown.errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.httpx.TimeoutException: If the request takes longer than Client.timeout.
builtins.list[LocalMetricConfig]: List of local metric configurations that must be computed client-side. Server-side metrics are automatically registered with Galileo and don’t need to be returned since users don’t interact with them.
get_log_stream
project_id or project_name must be provided.
Arguments
name(Optional[str]): The name of the log stream. Defaults to None.project_id(Optional[str]): The ID of the project. Defaults to None.project_name(Optional[str]): The name of the project. Defaults to None.
ValueError: If neither or bothproject_idandproject_nameare provided.errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.httpx.TimeoutException: If the request takes longer than Client.timeout.
Optional[LogStream]: The log stream if found, None otherwise.
list_log_streams
project_id or project_name must be provided.
Arguments
project_id(str): The id of the project.project_name(str): The name of the project.
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.httpx.TimeoutException: If the request takes longer than Client.timeout.
list[LogStream]: A list of Log streams.