Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/galileo/__future__/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from galileo.experiment import Experiment
from galileo.integration import Integration
from galileo.log_stream import LogStream
from galileo.metric import CodeMetric, GalileoMetric, LlmMetric, LocalMetric, Metric
from galileo.metric import CodeMetric, SplunkAOMetric, LlmMetric, LocalMetric, Metric
from galileo.model import Model
from galileo.project import Project
from galileo.prompt import Prompt
Expand All @@ -15,7 +15,7 @@
from galileo.shared.exceptions import (
APIError,
ConfigurationError,
GalileoFutureError,
SplunkAOFutureError,
ResourceConflictError,
ResourceNotFoundError,
ValidationError,
Expand All @@ -33,8 +33,8 @@
"ConfigurationError",
"Dataset",
"Experiment",
"GalileoFutureError",
"GalileoMetric",
"SplunkAOFutureError",
"SplunkAOMetric",
"Integration",
"LlmMetric",
"LocalMetric",
Expand Down
4 changes: 2 additions & 2 deletions src/galileo/__future__/metric.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
stacklevel=2,
)

from galileo.metric import BuiltInMetrics, CodeMetric, GalileoMetric, LlmMetric, LocalMetric, Metric # noqa: E402
from galileo.metric import BuiltInMetrics, CodeMetric, SplunkAOMetric, LlmMetric, LocalMetric, Metric # noqa: E402

__all__ = ["BuiltInMetrics", "CodeMetric", "GalileoMetric", "LlmMetric", "LocalMetric", "Metric"]
__all__ = ["BuiltInMetrics", "CodeMetric", "SplunkAOMetric", "LlmMetric", "LocalMetric", "Metric"]
4 changes: 2 additions & 2 deletions src/galileo/__future__/shared/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from galileo.shared.exceptions import ( # noqa: E402
APIError,
ConfigurationError,
GalileoFutureError,
SplunkAOFutureError,
IntegrationNotConfiguredError,
ResourceConflictError,
ResourceNotFoundError,
Expand All @@ -22,7 +22,7 @@
__all__ = [
"APIError",
"ConfigurationError",
"GalileoFutureError",
"SplunkAOFutureError",
"IntegrationNotConfiguredError",
"ResourceConflictError",
"ResourceNotFoundError",
Expand Down
32 changes: 16 additions & 16 deletions src/galileo/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,38 +4,38 @@
from galileo.collaborator import Collaborator, CollaboratorRole
from galileo.configuration import Configuration
from galileo.dataset import Dataset
from galileo.decorator import GalileoDecorator, galileo_context, log, start_session
from galileo.decorator import SplunkAODecorator, galileo_context, log, start_session
from galileo.exceptions import (
AuthenticationError,
BadRequestError,
ConflictError,
ForbiddenError,
GalileoAPIError,
GalileoLoggerException,
SplunkAOAPIError,
SplunkAOLoggerException,
NotFoundError,
RateLimitError,
ServerError,
)
from galileo.experiment import Experiment
from galileo.handlers.agent_control import GalileoAgentControlBridge, setup_agent_control_bridge
from galileo.handlers.agent_control import SplunkAOAgentControlBridge, setup_agent_control_bridge
from galileo.integration import Integration
from galileo.log_stream import LogStream
from galileo.logger import GalileoLogger
from galileo.logger import SplunkAOLogger
from galileo.logger.control import ControlAppliesTo, ControlCheckStage, ControlResult, ControlSpan
from galileo.metric import CodeMetric, GalileoMetric, LlmMetric, LocalMetric, Metric
from galileo.metric import CodeMetric, SplunkAOMetric, LlmMetric, LocalMetric, Metric
from galileo.model import Model
from galileo.project import Project
from galileo.prompt import Prompt
from galileo.protect import ainvoke_protect, invoke_protect
from galileo.provider import AnthropicProvider, AzureProvider, BedrockProvider, OpenAIProvider, Provider
from galileo.resources.models.document import Document
from galileo.schema.message import Message
from galileo.schema.metrics import GalileoMetrics, GalileoScorers
from galileo.schema.metrics import SplunkAOMetrics, GalileoScorers
from galileo.shared.base import SyncState
from galileo.shared.exceptions import (
APIError,
ConfigurationError,
GalileoFutureError,
SplunkAOFutureError,
ResourceConflictError,
ResourceNotFoundError,
ValidationError,
Expand Down Expand Up @@ -99,14 +99,14 @@
"ExecutionStatus",
"Experiment",
"ForbiddenError",
"GalileoAPIError",
"GalileoAgentControlBridge",
"GalileoDecorator",
"GalileoFutureError",
"GalileoLogger",
"GalileoLoggerException",
"GalileoMetric",
"GalileoMetrics",
"SplunkAOAPIError",
"SplunkAOAgentControlBridge",
"SplunkAODecorator",
"SplunkAOFutureError",
"SplunkAOLogger",
"SplunkAOLoggerException",
"SplunkAOMetric",
"SplunkAOMetrics",
"GalileoScorers",
"Integration",
"LlmMetric",
Expand Down
6 changes: 3 additions & 3 deletions src/galileo/agent_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

from galileo.decorator import galileo_context
from galileo.utils.env_helpers import _get_log_stream_or_default, _get_project_or_default
from galileo.utils.singleton import GalileoLoggerSingleton
from galileo.utils.singleton import SplunkAOLoggerSingleton

LOG_STREAM_TARGET_TYPE = "log_stream"

Expand Down Expand Up @@ -137,9 +137,9 @@ def _resolve_log_stream_from_cached_context() -> AgentControlTarget | None:

# Read cached logger state directly so this helper never creates or resolves
# projects/log streams as a side effect of building an Agent Control target.
# Use the same default/env fallback as GalileoLogger so callers that rely on
# Use the same default/env fallback as SplunkAOLogger so callers that rely on
# default project/log-stream creation can still reuse the resolved IDs.
for key, logger in GalileoLoggerSingleton().get_all_loggers().items():
for key, logger in SplunkAOLoggerSingleton().get_all_loggers().items():
if not key or key[0] != current_thread_name:
continue
if logger.project_name != current_project or logger.log_stream_name != current_log_stream:
Expand Down
12 changes: 6 additions & 6 deletions src/galileo/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,26 @@
from galileo_core.schemas.base_config import GalileoConfig


class GalileoPythonConfig(GalileoConfig):
class SplunkAOConfig(GalileoConfig):
# Config file for this project.
config_filename: str = "galileo-python-config.json"
console_url: Url = DEFAULT_CONSOLE_URL

_instance: ClassVar[Optional["GalileoPythonConfig"]] = None
_instance: ClassVar[Optional["SplunkAOConfig"]] = None

def reset(self) -> None:
GalileoPythonConfig._instance = None
SplunkAOConfig._instance = None
super().reset()

@classmethod
def get(cls, **kwargs: Any) -> "GalileoPythonConfig":
def get(cls, **kwargs: Any) -> "SplunkAOConfig":
if cls._instance is None:
cls._bridge_env_vars()
error_message = cls._check_auth_config(kwargs)
if error_message is not None:
raise ConfigurationError(error_message)
cls._instance = cls._get(cls._instance, **kwargs)
assert cls._instance is not None, "Failed to initialize GalileoPythonConfig"
assert cls._instance is not None, "Failed to initialize SplunkAOConfig"
return cls._instance

@staticmethod
Expand Down Expand Up @@ -130,6 +130,6 @@ def _val(kwarg_name: str, env_name: str) -> str | None:
"No Splunk AO authentication detected. Set one of: "
"SPLUNK_AO_API_KEY; SPLUNK_AO_SSO_ID_TOKEN with SPLUNK_AO_SSO_PROVIDER; "
"or SPLUNK_AO_USERNAME with SPLUNK_AO_PASSWORD. "
"Alternatively, pass the equivalent kwargs to GalileoPythonConfig.get(). "
"Alternatively, pass the equivalent kwargs to SplunkAOConfig.get(). "
"See https://docs.splunk.com for setup instructions."
)
10 changes: 5 additions & 5 deletions src/galileo/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from pathlib import Path
from typing import Any

from galileo.config import GalileoPythonConfig
from galileo.config import SplunkAOConfig
from galileo.constants import DEFAULT_CONSOLE_URL
from galileo.shared.exceptions import ConfigurationError
from galileo.utils.log_config import enable_console_logging as _enable_console_logging
Expand Down Expand Up @@ -394,7 +394,7 @@ def connect(cls) -> None:
logger.info("Validating Galileo configuration and connectivity...")

try:
GalileoPythonConfig.get()
SplunkAOConfig.get()
logger.info("Successfully connected to Galileo")
except Exception as e:
error_msg = str(e)
Expand All @@ -419,10 +419,10 @@ def reset(cls) -> None:
cls._env_loaded = False

try:
if GalileoPythonConfig._instance is not None:
GalileoPythonConfig._instance.reset()
if SplunkAOConfig._instance is not None:
SplunkAOConfig._instance.reset()
except Exception as e:
logger.debug(f"Could not reset GalileoPythonConfig instance: {e}")
logger.debug(f"Could not reset SplunkAOConfig instance: {e}")

@classmethod
def is_configured(cls) -> bool:
Expand Down
10 changes: 5 additions & 5 deletions src/galileo/datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import time
from typing import Any, overload

from galileo.config import GalileoPythonConfig
from galileo.config import SplunkAOConfig
from galileo.resources.api.datasets import (
create_dataset_datasets_post,
delete_dataset_datasets_dataset_id_delete,
Expand Down Expand Up @@ -59,11 +59,11 @@ class DatasetAPIException(APIException):

class Dataset:
content: DatasetContent | None = None
config: GalileoPythonConfig
config: SplunkAOConfig

def __init__(self, dataset_db: DatasetDB) -> None:
self.dataset = dataset_db
self.config = GalileoPythonConfig.get()
self.config = SplunkAOConfig.get()

def get_content(self, starting_token: int = 0, limit: int = MAX_DATASET_ROWS) -> None | DatasetContent:
"""
Expand Down Expand Up @@ -205,10 +205,10 @@ def __getattr__(self, attr: str) -> Any:


class Datasets:
config: GalileoPythonConfig
config: SplunkAOConfig

def __init__(self) -> None:
self.config = GalileoPythonConfig.get()
self.config = SplunkAOConfig.get()

def list(
self, limit: Unset | int = 100, *, project_id: str | None = None, project_name: str | None = None
Expand Down
34 changes: 17 additions & 17 deletions src/galileo/decorator.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def call_llm(prompt, temperature=0.7):
from typing_extensions import ParamSpec

from galileo.constants import LoggerModeType
from galileo.logger import GalileoLogger
from galileo.logger import SplunkAOLogger
from galileo.logger.logger import STUB_TRACE_NAME
from galileo.schema.content_blocks import is_content_block_list
from galileo.schema.datasets import DatasetRecord
Expand All @@ -67,7 +67,7 @@ def call_llm(prompt, temperature=0.7):
from galileo.utils import _get_timestamp
from galileo.utils.env_helpers import _get_mode_or_default
from galileo.utils.serialization import EventSerializer, convert_time_delta_to_ns, serialize_to_str
from galileo.utils.singleton import GalileoLoggerSingleton
from galileo.utils.singleton import SplunkAOLoggerSingleton
from galileo.utils.span_utils import is_concludable_span_type, is_textual_span_type
from galileo_core.schemas.logging.span import WorkflowSpan
from galileo_core.schemas.logging.trace import Trace
Expand Down Expand Up @@ -123,7 +123,7 @@ def _get_or_init_list(context_var: ContextVar, default_factory: Callable = list)
return value


class GalileoDecorator:
class SplunkAODecorator:
"""
Main decorator class that provides both decorator and context manager functionality
for logging and tracing in Galileo.
Expand All @@ -133,13 +133,13 @@ class GalileoDecorator:
2. A context manager via the `__call__` method
"""

def __enter__(self) -> "GalileoDecorator":
def __enter__(self) -> "SplunkAODecorator":
"""
Entry point for the context manager.

Returns
-------
GalileoDecorator
SplunkAODecorator
The decorator instance for use in a with statement
"""
# Nothing to do here since __call__ has already set up the context
Expand Down Expand Up @@ -188,7 +188,7 @@ def __call__(
experiment_id: str | None = None,
mode: str | None = None,
session_id: str | None = None,
) -> "GalileoDecorator":
) -> "SplunkAODecorator":
"""
Call method to use the decorator as a context manager.

Expand All @@ -213,7 +213,7 @@ def __call__(

Returns
-------
GalileoDecorator
SplunkAODecorator
The decorator instance for use in a with statement
"""
# Push current values onto the stacks
Expand Down Expand Up @@ -859,9 +859,9 @@ def _handle_call_result(self, span_type: SPAN_TYPE | None, span_params: dict[str
# _coerce_output preserves str and List[ContentBlock],
# serializes everything else (Message, List[Document], etc.) to JSON string.
if output is not None:
current_parent.output = GalileoLogger._coerce_output(output)
current_parent.output = SplunkAOLogger._coerce_output(output)
if redacted_output is not None:
current_parent.redacted_output = GalileoLogger._coerce_output(redacted_output)
current_parent.redacted_output = SplunkAOLogger._coerce_output(redacted_output)

# Update trace duration
# Note: In distributed mode, trace.created_at may be set by the server
Expand Down Expand Up @@ -992,7 +992,7 @@ def get_logger_instance(
experiment_id: str | None = None,
mode: str | None = None,
ingestion_hook: Callable | None = None,
) -> GalileoLogger:
) -> SplunkAOLogger:
"""
Get the Galileo Logger instance for the current decorator context.

Expand All @@ -1009,7 +1009,7 @@ def get_logger_instance(

Returns
-------
GalileoLogger instance configured with the specified project and log stream
SplunkAOLogger instance configured with the specified project and log stream
"""
kwargs = {
"project": project or _project_context.get(),
Expand All @@ -1026,7 +1026,7 @@ def get_logger_instance(
if ingestion_hook is not None:
kwargs["ingestion_hook"] = ingestion_hook

return GalileoLoggerSingleton().get(**kwargs)
return SplunkAOLoggerSingleton().get(**kwargs)

def get_current_project(self) -> str | None:
"""
Expand Down Expand Up @@ -1151,7 +1151,7 @@ def flush_all(self) -> None:

This method flushes all traces regardless of project or log stream.
"""
GalileoLoggerSingleton().flush_all()
SplunkAOLoggerSingleton().flush_all()
_span_stack_context.set([])
_trace_context.set(None)

Expand All @@ -1161,7 +1161,7 @@ def reset(self) -> None:

This method clears all context variables and resets the logger singleton.
"""
GalileoLoggerSingleton().reset(
SplunkAOLoggerSingleton().reset(
project=_project_context.get(),
log_stream=_log_stream_context.get(),
experiment_id=_experiment_id_context.get(),
Expand Down Expand Up @@ -1220,8 +1220,8 @@ def init(
mode
The logger mode.
"""
GalileoLoggerSingleton().reset(project=project, log_stream=log_stream, experiment_id=experiment_id)
logger_instance = GalileoLoggerSingleton().get(
SplunkAOLoggerSingleton().reset(project=project, log_stream=log_stream, experiment_id=experiment_id)
logger_instance = SplunkAOLoggerSingleton().get(
project=project, log_stream=log_stream, experiment_id=experiment_id, local_metrics=local_metrics, mode=mode
)
# Reset the logger's parent tracking to ensure clean state
Expand Down Expand Up @@ -1285,7 +1285,7 @@ def set_session(self, session_id: str) -> None:
self.get_logger_instance().set_session(session_id)


galileo_context = GalileoDecorator()
galileo_context = SplunkAODecorator()
log = galileo_context.log
start_session = galileo_context.start_session

Expand Down
Loading
Loading