Skip to content
Closed
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
27 changes: 18 additions & 9 deletions langfuse/api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,6 @@
IngestionEvent_ObservationCreate,
IngestionEvent_ObservationUpdate,
IngestionEvent_ScoreCreate,
IngestionEvent_SdkLog,
IngestionEvent_SpanCreate,
IngestionEvent_SpanUpdate,
IngestionEvent_TraceCreate,
Expand All @@ -320,8 +319,6 @@
OptionalObservationBody,
ScoreBody,
ScoreEvent,
SdkLogBody,
SdkLogEvent,
TraceBody,
TraceEvent,
UpdateEventBody,
Expand Down Expand Up @@ -427,9 +424,15 @@
UpdateScoreConfigRequest,
)
from .scores import (
CreateScoreBatchError,
CreateScoreBatchRequest,
CreateScoreBatchResponse,
CreateScoreBatchResults,
CreateScoreRequest,
CreateScoreResponse,
CreateScoreSource,
CreateScoresRequest,
CreateScoresResponse,
GetScoresResponse,
GetScoresResponseData,
GetScoresResponseDataBoolean,
Expand Down Expand Up @@ -549,11 +552,17 @@
"CreateModelRequest": ".models",
"CreateObservationEvent": ".ingestion",
"CreatePromptRequest": ".prompts",
"CreateScoreBatchError": ".scores",
"CreateScoreBatchRequest": ".scores",
"CreateScoreBatchResponse": ".scores",
"CreateScoreBatchResults": ".scores",
"CreateScoreConfigRequest": ".score_configs",
"CreateScoreRequest": ".scores",
"CreateScoreResponse": ".scores",
"CreateScoreSource": ".scores",
"CreateScoreValue": ".commons",
"CreateScoresRequest": ".scores",
"CreateScoresResponse": ".scores",
"CreateSpanBody": ".ingestion",
"CreateSpanEvent": ".ingestion",
"CreateTextPromptRequest": ".prompts",
Expand Down Expand Up @@ -671,7 +680,6 @@
"IngestionEvent_ObservationCreate": ".ingestion",
"IngestionEvent_ObservationUpdate": ".ingestion",
"IngestionEvent_ScoreCreate": ".ingestion",
"IngestionEvent_SdkLog": ".ingestion",
"IngestionEvent_SpanCreate": ".ingestion",
"IngestionEvent_SpanUpdate": ".ingestion",
"IngestionEvent_TraceCreate": ".ingestion",
Expand Down Expand Up @@ -822,8 +830,6 @@
"Score_Correction": ".commons",
"Score_Numeric": ".commons",
"Score_Text": ".commons",
"SdkLogBody": ".ingestion",
"SdkLogEvent": ".ingestion",
"ServiceProviderConfig": ".scim",
"ServiceUnavailableError": ".health",
"Session": ".commons",
Expand Down Expand Up @@ -1005,11 +1011,17 @@ def __dir__():
"CreateModelRequest",
"CreateObservationEvent",
"CreatePromptRequest",
"CreateScoreBatchError",
"CreateScoreBatchRequest",
"CreateScoreBatchResponse",
"CreateScoreBatchResults",
"CreateScoreConfigRequest",
"CreateScoreRequest",
"CreateScoreResponse",
"CreateScoreSource",
"CreateScoreValue",
"CreateScoresRequest",
"CreateScoresResponse",
"CreateSpanBody",
"CreateSpanEvent",
"CreateTextPromptRequest",
Expand Down Expand Up @@ -1127,7 +1139,6 @@ def __dir__():
"IngestionEvent_ObservationCreate",
"IngestionEvent_ObservationUpdate",
"IngestionEvent_ScoreCreate",
"IngestionEvent_SdkLog",
"IngestionEvent_SpanCreate",
"IngestionEvent_SpanUpdate",
"IngestionEvent_TraceCreate",
Expand Down Expand Up @@ -1278,8 +1289,6 @@ def __dir__():
"Score_Correction",
"Score_Numeric",
"Score_Text",
"SdkLogBody",
"SdkLogEvent",
"ServiceProviderConfig",
"ServiceUnavailableError",
"Session",
Expand Down
24 changes: 14 additions & 10 deletions langfuse/api/blob_storage_integrations/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,10 @@ def upsert_blob_storage_integration(
type : BlobStorageIntegrationType

bucket_name : str
Name of the storage bucket. For AZURE_BLOB_STORAGE, must be a valid Azure container name (3-63 chars, lowercase letters, numbers, and hyphens only, must start and end with a letter or number, no consecutive hyphens).
Name of the storage bucket. For AZURE_BLOB_STORAGE, must be a valid Azure container name (3-63 chars, lowercase letters, numbers, and hyphens only, must start and end with a letter or number, no consecutive hyphens). For GOOGLE_CLOUD_STORAGE with default credentials, the bucket must be listed in `LANGFUSE_BLOB_STORAGE_GCS_ALLOWED_BUCKETS`.

region : str
Storage region used by S3-compatible clients (AWS, GCS, Cloudflare R2, MinIO, Azure location IDs such as eastus, OCI). Leading and trailing whitespace is removed. The remaining value must be 1-63 letters, numbers, or hyphens, and cannot start or end with a hyphen. Examples: us-east-1, europe-west1, eastus, auto.
Storage region used by S3-compatible clients (AWS, GCS, Cloudflare R2, MinIO, Azure location IDs such as eastus, OCI). Leading and trailing whitespace is removed. The remaining value must be 1-63 letters, numbers, or hyphens, and cannot start or end with a hyphen. Examples: us-east-1, europe-west1, eastus, auto. Not used by GOOGLE_CLOUD_STORAGE; pass auto.

export_frequency : BlobStorageExportFrequency

Expand All @@ -132,13 +132,15 @@ def upsert_blob_storage_integration(
export_mode : BlobStorageExportMode

endpoint : typing.Optional[str]
Custom endpoint URL (required for S3_COMPATIBLE type)
Custom endpoint URL (required for S3_COMPATIBLE type). Ignored for GOOGLE_CLOUD_STORAGE.

access_key_id : typing.Optional[str]
Access key ID for authentication
Access key ID for authentication. Not used for GOOGLE_CLOUD_STORAGE.

secret_access_key : typing.Optional[str]
Secret access key for authentication (will be encrypted when stored)
Secret access key for authentication (will be encrypted when stored). When omitted on update, the stored secret is kept, unless the type changes between GOOGLE_CLOUD_STORAGE and another type.

For GOOGLE_CLOUD_STORAGE, a GCP service account JSON key. On self-hosted deployments, pass `__GCS_DEFAULT_CREDENTIALS__` instead to use the deployment's Application Default Credentials; the bucket must then be listed in `LANGFUSE_BLOB_STORAGE_GCS_ALLOWED_BUCKETS`. Default credentials are not available on Langfuse Cloud.

prefix : typing.Optional[str]
Path prefix for exported files (must end with forward slash if provided)
Expand Down Expand Up @@ -391,10 +393,10 @@ async def upsert_blob_storage_integration(
type : BlobStorageIntegrationType

bucket_name : str
Name of the storage bucket. For AZURE_BLOB_STORAGE, must be a valid Azure container name (3-63 chars, lowercase letters, numbers, and hyphens only, must start and end with a letter or number, no consecutive hyphens).
Name of the storage bucket. For AZURE_BLOB_STORAGE, must be a valid Azure container name (3-63 chars, lowercase letters, numbers, and hyphens only, must start and end with a letter or number, no consecutive hyphens). For GOOGLE_CLOUD_STORAGE with default credentials, the bucket must be listed in `LANGFUSE_BLOB_STORAGE_GCS_ALLOWED_BUCKETS`.

region : str
Storage region used by S3-compatible clients (AWS, GCS, Cloudflare R2, MinIO, Azure location IDs such as eastus, OCI). Leading and trailing whitespace is removed. The remaining value must be 1-63 letters, numbers, or hyphens, and cannot start or end with a hyphen. Examples: us-east-1, europe-west1, eastus, auto.
Storage region used by S3-compatible clients (AWS, GCS, Cloudflare R2, MinIO, Azure location IDs such as eastus, OCI). Leading and trailing whitespace is removed. The remaining value must be 1-63 letters, numbers, or hyphens, and cannot start or end with a hyphen. Examples: us-east-1, europe-west1, eastus, auto. Not used by GOOGLE_CLOUD_STORAGE; pass auto.

export_frequency : BlobStorageExportFrequency

Expand All @@ -409,13 +411,15 @@ async def upsert_blob_storage_integration(
export_mode : BlobStorageExportMode

endpoint : typing.Optional[str]
Custom endpoint URL (required for S3_COMPATIBLE type)
Custom endpoint URL (required for S3_COMPATIBLE type). Ignored for GOOGLE_CLOUD_STORAGE.

access_key_id : typing.Optional[str]
Access key ID for authentication
Access key ID for authentication. Not used for GOOGLE_CLOUD_STORAGE.

secret_access_key : typing.Optional[str]
Secret access key for authentication (will be encrypted when stored)
Secret access key for authentication (will be encrypted when stored). When omitted on update, the stored secret is kept, unless the type changes between GOOGLE_CLOUD_STORAGE and another type.

For GOOGLE_CLOUD_STORAGE, a GCP service account JSON key. On self-hosted deployments, pass `__GCS_DEFAULT_CREDENTIALS__` instead to use the deployment's Application Default Credentials; the bucket must then be listed in `LANGFUSE_BLOB_STORAGE_GCS_ALLOWED_BUCKETS`. Default credentials are not available on Langfuse Cloud.

prefix : typing.Optional[str]
Path prefix for exported files (must end with forward slash if provided)
Expand Down
24 changes: 14 additions & 10 deletions langfuse/api/blob_storage_integrations/raw_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,10 @@ def upsert_blob_storage_integration(
type : BlobStorageIntegrationType

bucket_name : str
Name of the storage bucket. For AZURE_BLOB_STORAGE, must be a valid Azure container name (3-63 chars, lowercase letters, numbers, and hyphens only, must start and end with a letter or number, no consecutive hyphens).
Name of the storage bucket. For AZURE_BLOB_STORAGE, must be a valid Azure container name (3-63 chars, lowercase letters, numbers, and hyphens only, must start and end with a letter or number, no consecutive hyphens). For GOOGLE_CLOUD_STORAGE with default credentials, the bucket must be listed in `LANGFUSE_BLOB_STORAGE_GCS_ALLOWED_BUCKETS`.

region : str
Storage region used by S3-compatible clients (AWS, GCS, Cloudflare R2, MinIO, Azure location IDs such as eastus, OCI). Leading and trailing whitespace is removed. The remaining value must be 1-63 letters, numbers, or hyphens, and cannot start or end with a hyphen. Examples: us-east-1, europe-west1, eastus, auto.
Storage region used by S3-compatible clients (AWS, GCS, Cloudflare R2, MinIO, Azure location IDs such as eastus, OCI). Leading and trailing whitespace is removed. The remaining value must be 1-63 letters, numbers, or hyphens, and cannot start or end with a hyphen. Examples: us-east-1, europe-west1, eastus, auto. Not used by GOOGLE_CLOUD_STORAGE; pass auto.

export_frequency : BlobStorageExportFrequency

Expand All @@ -189,13 +189,15 @@ def upsert_blob_storage_integration(
export_mode : BlobStorageExportMode

endpoint : typing.Optional[str]
Custom endpoint URL (required for S3_COMPATIBLE type)
Custom endpoint URL (required for S3_COMPATIBLE type). Ignored for GOOGLE_CLOUD_STORAGE.

access_key_id : typing.Optional[str]
Access key ID for authentication
Access key ID for authentication. Not used for GOOGLE_CLOUD_STORAGE.

secret_access_key : typing.Optional[str]
Secret access key for authentication (will be encrypted when stored)
Secret access key for authentication (will be encrypted when stored). When omitted on update, the stored secret is kept, unless the type changes between GOOGLE_CLOUD_STORAGE and another type.

For GOOGLE_CLOUD_STORAGE, a GCP service account JSON key. On self-hosted deployments, pass `__GCS_DEFAULT_CREDENTIALS__` instead to use the deployment's Application Default Credentials; the bucket must then be listed in `LANGFUSE_BLOB_STORAGE_GCS_ALLOWED_BUCKETS`. Default credentials are not available on Langfuse Cloud.

prefix : typing.Optional[str]
Path prefix for exported files (must end with forward slash if provided)
Expand Down Expand Up @@ -666,10 +668,10 @@ async def upsert_blob_storage_integration(
type : BlobStorageIntegrationType

bucket_name : str
Name of the storage bucket. For AZURE_BLOB_STORAGE, must be a valid Azure container name (3-63 chars, lowercase letters, numbers, and hyphens only, must start and end with a letter or number, no consecutive hyphens).
Name of the storage bucket. For AZURE_BLOB_STORAGE, must be a valid Azure container name (3-63 chars, lowercase letters, numbers, and hyphens only, must start and end with a letter or number, no consecutive hyphens). For GOOGLE_CLOUD_STORAGE with default credentials, the bucket must be listed in `LANGFUSE_BLOB_STORAGE_GCS_ALLOWED_BUCKETS`.

region : str
Storage region used by S3-compatible clients (AWS, GCS, Cloudflare R2, MinIO, Azure location IDs such as eastus, OCI). Leading and trailing whitespace is removed. The remaining value must be 1-63 letters, numbers, or hyphens, and cannot start or end with a hyphen. Examples: us-east-1, europe-west1, eastus, auto.
Storage region used by S3-compatible clients (AWS, GCS, Cloudflare R2, MinIO, Azure location IDs such as eastus, OCI). Leading and trailing whitespace is removed. The remaining value must be 1-63 letters, numbers, or hyphens, and cannot start or end with a hyphen. Examples: us-east-1, europe-west1, eastus, auto. Not used by GOOGLE_CLOUD_STORAGE; pass auto.

export_frequency : BlobStorageExportFrequency

Expand All @@ -684,13 +686,15 @@ async def upsert_blob_storage_integration(
export_mode : BlobStorageExportMode

endpoint : typing.Optional[str]
Custom endpoint URL (required for S3_COMPATIBLE type)
Custom endpoint URL (required for S3_COMPATIBLE type). Ignored for GOOGLE_CLOUD_STORAGE.

access_key_id : typing.Optional[str]
Access key ID for authentication
Access key ID for authentication. Not used for GOOGLE_CLOUD_STORAGE.

secret_access_key : typing.Optional[str]
Secret access key for authentication (will be encrypted when stored)
Secret access key for authentication (will be encrypted when stored). When omitted on update, the stored secret is kept, unless the type changes between GOOGLE_CLOUD_STORAGE and another type.

For GOOGLE_CLOUD_STORAGE, a GCP service account JSON key. On self-hosted deployments, pass `__GCS_DEFAULT_CREDENTIALS__` instead to use the deployment's Application Default Credentials; the bucket must then be listed in `LANGFUSE_BLOB_STORAGE_GCS_ALLOWED_BUCKETS`. Default credentials are not available on Langfuse Cloud.

prefix : typing.Optional[str]
Path prefix for exported files (must end with forward slash if provided)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,20 @@ class BlobStorageIntegrationType(enum.StrEnum):
S3 = "S3"
S3COMPATIBLE = "S3_COMPATIBLE"
AZURE_BLOB_STORAGE = "AZURE_BLOB_STORAGE"
GOOGLE_CLOUD_STORAGE = "GOOGLE_CLOUD_STORAGE"

def visit(
self,
s3: typing.Callable[[], T_Result],
s3compatible: typing.Callable[[], T_Result],
azure_blob_storage: typing.Callable[[], T_Result],
google_cloud_storage: typing.Callable[[], T_Result],
) -> T_Result:
if self is BlobStorageIntegrationType.S3:
return s3()
if self is BlobStorageIntegrationType.S3COMPATIBLE:
return s3compatible()
if self is BlobStorageIntegrationType.AZURE_BLOB_STORAGE:
return azure_blob_storage()
if self is BlobStorageIntegrationType.GOOGLE_CLOUD_STORAGE:
return google_cloud_storage()
Original file line number Diff line number Diff line change
Expand Up @@ -28,31 +28,33 @@ class CreateBlobStorageIntegrationRequest(UniversalBaseModel):
pydantic.Field()
)
"""
Name of the storage bucket. For AZURE_BLOB_STORAGE, must be a valid Azure container name (3-63 chars, lowercase letters, numbers, and hyphens only, must start and end with a letter or number, no consecutive hyphens).
Name of the storage bucket. For AZURE_BLOB_STORAGE, must be a valid Azure container name (3-63 chars, lowercase letters, numbers, and hyphens only, must start and end with a letter or number, no consecutive hyphens). For GOOGLE_CLOUD_STORAGE with default credentials, the bucket must be listed in `LANGFUSE_BLOB_STORAGE_GCS_ALLOWED_BUCKETS`.
"""

endpoint: typing.Optional[str] = pydantic.Field(default=None)
"""
Custom endpoint URL (required for S3_COMPATIBLE type)
Custom endpoint URL (required for S3_COMPATIBLE type). Ignored for GOOGLE_CLOUD_STORAGE.
"""

region: str = pydantic.Field()
"""
Storage region used by S3-compatible clients (AWS, GCS, Cloudflare R2, MinIO, Azure location IDs such as eastus, OCI). Leading and trailing whitespace is removed. The remaining value must be 1-63 letters, numbers, or hyphens, and cannot start or end with a hyphen. Examples: us-east-1, europe-west1, eastus, auto.
Storage region used by S3-compatible clients (AWS, GCS, Cloudflare R2, MinIO, Azure location IDs such as eastus, OCI). Leading and trailing whitespace is removed. The remaining value must be 1-63 letters, numbers, or hyphens, and cannot start or end with a hyphen. Examples: us-east-1, europe-west1, eastus, auto. Not used by GOOGLE_CLOUD_STORAGE; pass auto.
"""

access_key_id: typing_extensions.Annotated[
typing.Optional[str], FieldMetadata(alias="accessKeyId")
] = pydantic.Field(default=None)
"""
Access key ID for authentication
Access key ID for authentication. Not used for GOOGLE_CLOUD_STORAGE.
"""

secret_access_key: typing_extensions.Annotated[
typing.Optional[str], FieldMetadata(alias="secretAccessKey")
] = pydantic.Field(default=None)
"""
Secret access key for authentication (will be encrypted when stored)
Secret access key for authentication (will be encrypted when stored). When omitted on update, the stored secret is kept, unless the type changes between GOOGLE_CLOUD_STORAGE and another type.

For GOOGLE_CLOUD_STORAGE, a GCP service account JSON key. On self-hosted deployments, pass `__GCS_DEFAULT_CREDENTIALS__` instead to use the deployment's Application Default Credentials; the bucket must then be listed in `LANGFUSE_BLOB_STORAGE_GCS_ALLOWED_BUCKETS`. Default credentials are not available on Langfuse Cloud.
"""

prefix: typing.Optional[str] = pydantic.Field(default=None)
Expand Down
9 changes: 0 additions & 9 deletions langfuse/api/ingestion/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
IngestionEvent_ObservationCreate,
IngestionEvent_ObservationUpdate,
IngestionEvent_ScoreCreate,
IngestionEvent_SdkLog,
IngestionEvent_SpanCreate,
IngestionEvent_SpanUpdate,
IngestionEvent_TraceCreate,
Expand All @@ -38,8 +37,6 @@
OptionalObservationBody,
ScoreBody,
ScoreEvent,
SdkLogBody,
SdkLogEvent,
TraceBody,
TraceEvent,
UpdateEventBody,
Expand Down Expand Up @@ -67,7 +64,6 @@
"IngestionEvent_ObservationCreate": ".types",
"IngestionEvent_ObservationUpdate": ".types",
"IngestionEvent_ScoreCreate": ".types",
"IngestionEvent_SdkLog": ".types",
"IngestionEvent_SpanCreate": ".types",
"IngestionEvent_SpanUpdate": ".types",
"IngestionEvent_TraceCreate": ".types",
Expand All @@ -82,8 +78,6 @@
"OptionalObservationBody": ".types",
"ScoreBody": ".types",
"ScoreEvent": ".types",
"SdkLogBody": ".types",
"SdkLogEvent": ".types",
"TraceBody": ".types",
"TraceEvent": ".types",
"UpdateEventBody": ".types",
Expand Down Expand Up @@ -140,7 +134,6 @@ def __dir__():
"IngestionEvent_ObservationCreate",
"IngestionEvent_ObservationUpdate",
"IngestionEvent_ScoreCreate",
"IngestionEvent_SdkLog",
"IngestionEvent_SpanCreate",
"IngestionEvent_SpanUpdate",
"IngestionEvent_TraceCreate",
Expand All @@ -155,8 +148,6 @@ def __dir__():
"OptionalObservationBody",
"ScoreBody",
"ScoreEvent",
"SdkLogBody",
"SdkLogEvent",
"TraceBody",
"TraceEvent",
"UpdateEventBody",
Expand Down
Loading
Loading