@langfuse/core 5.3.0 → 5.4.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +26 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +25 -1
- package/dist/index.d.ts +25 -1
- package/dist/index.mjs +23 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -225,6 +225,7 @@ declare enum LangfuseOtelSpanAttributes {
|
|
|
225
225
|
RELEASE = "langfuse.release",
|
|
226
226
|
VERSION = "langfuse.version",
|
|
227
227
|
AS_ROOT = "langfuse.internal.as_root",
|
|
228
|
+
IS_APP_ROOT = "langfuse.internal.is_app_root",
|
|
228
229
|
EXPERIMENT_ID = "langfuse.experiment.id",
|
|
229
230
|
EXPERIMENT_NAME = "langfuse.experiment.name",
|
|
230
231
|
EXPERIMENT_DESCRIPTION = "langfuse.experiment.description",
|
|
@@ -8422,6 +8423,29 @@ type PropagatedExperimentAttributes = {
|
|
|
8422
8423
|
experimentItemRootObservationId: string;
|
|
8423
8424
|
};
|
|
8424
8425
|
declare const LangfuseOtelContextKeys: Record<PropagatedKey, symbol>;
|
|
8426
|
+
/**
|
|
8427
|
+
* Baggage key used by the SDK to claim that an upstream Langfuse-controlled
|
|
8428
|
+
* scope already exists for a given trace id. Downstream processors read this
|
|
8429
|
+
* to suppress duplicate app-root markers across services.
|
|
8430
|
+
*
|
|
8431
|
+
* @internal
|
|
8432
|
+
*/
|
|
8433
|
+
declare const LANGFUSE_TRACE_ID_BAGGAGE_KEY = "langfuse_trace_id";
|
|
8434
|
+
/**
|
|
8435
|
+
* Reads the Langfuse trace-id app-root claim from the baggage attached to a
|
|
8436
|
+
* context. Returns the lowercased trace id, or undefined if no claim exists.
|
|
8437
|
+
*
|
|
8438
|
+
* @internal
|
|
8439
|
+
*/
|
|
8440
|
+
declare function getLangfuseTraceIdFromBaggage(context: Context): string | undefined;
|
|
8441
|
+
/**
|
|
8442
|
+
* Returns a context that carries the Langfuse trace-id app-root claim in
|
|
8443
|
+
* baggage. If the context already carries the same claim, the original
|
|
8444
|
+
* context is returned unchanged so we don't churn baggage instances.
|
|
8445
|
+
*
|
|
8446
|
+
* @internal
|
|
8447
|
+
*/
|
|
8448
|
+
declare function setLangfuseTraceIdInBaggage(context: Context, traceId: string): Context;
|
|
8425
8449
|
/**
|
|
8426
8450
|
* Parameters for propagateAttributes function.
|
|
8427
8451
|
*
|
|
@@ -8587,4 +8611,4 @@ interface PropagateAttributesParams {
|
|
|
8587
8611
|
declare function propagateAttributes<A extends unknown[], F extends (...args: A) => ReturnType<F>>(params: PropagateAttributesParams, fn: F): ReturnType<F>;
|
|
8588
8612
|
declare function getPropagatedAttributesFromContext(context: Context): Record<string, string | string[]>;
|
|
8589
8613
|
|
|
8590
|
-
export { AccessDeniedError, type AnnotationQueue, type AnnotationQueueAssignmentRequest, type AnnotationQueueItem, AnnotationQueueObjectType, AnnotationQueueStatus, type ApiKeyDeletionResponse, type ApiKeyList, type ApiKeyResponse, type ApiKeySummary, type AuthenticationScheme, type BaseEvent, type BasePrompt, type BaseScore, type BaseScoreV1, BlobStorageExportFrequency, BlobStorageExportMode, type BlobStorageIntegrationDeletionResponse, BlobStorageIntegrationFileType, type BlobStorageIntegrationResponse, type BlobStorageIntegrationStatusResponse, BlobStorageIntegrationType, type BlobStorageIntegrationsResponse, BlobStorageSyncStatus, type BooleanScore, type BooleanScoreV1, type BulkConfig, type CategoricalScore, type CategoricalScoreV1, type ChatMessage, ChatMessageType, type ChatMessageWithPlaceholders, type ChatPrompt, type Comment, CommentObjectType, type ConfigCategory, type CorrectionScore, type CreateAnnotationQueueAssignmentResponse, type CreateAnnotationQueueItemRequest, type CreateAnnotationQueueRequest, type CreateApiKeyRequest, type CreateBlobStorageIntegrationRequest, type CreateChatPromptRequest, CreateChatPromptType, type CreateCommentRequest, type CreateCommentResponse, type CreateDatasetItemRequest, type CreateDatasetRequest, type CreateDatasetRunItemRequest, type CreateEventBody, type CreateEventEvent, type CreateGenerationBody, type CreateGenerationEvent, type CreateModelRequest, type CreateObservationEvent, type CreateProjectRequest, type CreatePromptRequest, type CreateScoreConfigRequest, type CreateScoreValue, type CreateSpanBody, type CreateSpanEvent, type CreateTextPromptRequest, CreateTextPromptType, type CreateUserRequest, type Dataset, type DatasetItem, type DatasetRun, type DatasetRunItem, type DatasetRunWithItems, DatasetStatus, type DeleteAnnotationQueueAssignmentResponse, type DeleteAnnotationQueueItemResponse, type DeleteDatasetItemResponse, type DeleteDatasetRunResponse, type DeleteMembershipRequest, type DeletePromptRequest, type DeleteTraceResponse, type DeleteTracesRequest, type EmptyResponse, Error$1 as Error, type FilterConfig, type GetAnnotationQueueItemsRequest, type GetAnnotationQueuesRequest, type GetCommentsRequest, type GetCommentsResponse, type GetDatasetItemsRequest, type GetDatasetRunsRequest, type GetDatasetsRequest, type GetLlmConnectionsRequest, type GetMediaResponse, type GetMediaUploadUrlRequest, type GetMediaUploadUrlResponse, type GetMetricsV2Request, type GetModelsRequest, type GetObservationsV2Request, type GetPromptRequest, type GetScoreConfigsRequest, type GetScoresRequest, type GetScoresResponse, GetScoresResponseData, type GetScoresResponseDataBoolean, type GetScoresResponseDataCategorical, type GetScoresResponseDataCorrection, type GetScoresResponseDataNumeric, type GetScoresResponseDataText, type GetScoresResponseTraceData, type GetSessionsRequest, type GetTraceRequest, type GetTracesRequest, type HealthResponse, type IngestionError, IngestionEvent, type IngestionRequest, type IngestionResponse, type IngestionSuccess, type IngestionUsage, LANGFUSE_SDK_EXPERIMENT_ENVIRONMENT, LANGFUSE_SDK_NAME, LANGFUSE_SDK_VERSION, LANGFUSE_TRACER_NAME, LangfuseAPIClient, LangfuseAPIError, LangfuseAPITimeoutError, LangfuseMedia, type LangfuseMediaParams, LangfuseOtelContextKeys, LangfuseOtelSpanAttributes, type ListDatasetRunItemsRequest, type ListPromptsMetaRequest, type ListUsersRequest, LlmAdapter, type LlmConnection, LogLevel, Logger, type LoggerConfig, type MapValue, MediaContentType, type MembershipDeletionResponse, type MembershipRequest, type MembershipResponse, MembershipRole, type MembershipsResponse, MethodNotAllowedError, type MetricsV2Response, type Model, type ModelPrice, ModelUsageUnit, NotFoundError, type NumericScore, type NumericScoreV1, type Observation, type ObservationBody, ObservationLevel, ObservationType, type ObservationV2, type ObservationsV2Meta, type ObservationsV2Response, type ObservationsView, type OpenAiCompletionUsageSchema, type OpenAiResponseUsageSchema, type OpenAiUsage, type OptionalObservationBody, type Organization, type OrganizationApiKey, type OrganizationApiKeysResponse, type OrganizationProject, type OrganizationProjectsResponse, type OtelAttribute, type OtelAttributeValue, type OtelResource, type OtelResourceSpan, type OtelScope, type OtelScopeSpan, type OtelSpan, type OtelTraceRequest, type OtelTraceResponse, type PaginatedAnnotationQueueItems, type PaginatedAnnotationQueues, type PaginatedDatasetItems, type PaginatedDatasetRunItems, type PaginatedDatasetRuns, type PaginatedDatasets, type PaginatedLlmConnections, type PaginatedModels, type PaginatedSessions, type ParsedMediaReference, type PatchMediaBody, type PlaceholderMessage, PlaceholderMessageType, type PricingTier, type PricingTierCondition, type PricingTierInput, PricingTierOperator, type Project, type ProjectDeletionResponse, type Projects$1 as Projects, Prompt, type PromptMeta, type PromptMetaListResponse, PromptType, type PropagateAttributesParams, type ResourceMeta, type ResourceType, type ResourceTypesResponse, type SchemaExtension, type SchemaResource, type SchemasResponse, type ScimEmail, type ScimFeatureSupport, type ScimName, type ScimUser, type ScimUsersListResponse, Score, type ScoreBody, type ScoreConfig, ScoreConfigDataType, type ScoreConfigs$1 as ScoreConfigs, ScoreDataType, type ScoreEvent, ScoreSource, ScoreV1$1 as ScoreV1, type SdkLogBody, type SdkLogEvent, type ServiceProviderConfig, ServiceUnavailableError, type Session, type SessionWithTraces, type Sort, type TextPrompt, type TextScore, type TextScoreV1, type Trace$1 as Trace, type TraceBody, type TraceEvent, type TraceWithDetails, type TraceWithFullDetails, type Traces, UnauthorizedError, type UpdateAnnotationQueueItemRequest, type UpdateEventBody, type UpdateGenerationBody, type UpdateGenerationEvent, type UpdateObservationEvent, type UpdateProjectRequest, type UpdatePromptRequest, type UpdateScoreConfigRequest, type UpdateSpanBody, type UpdateSpanEvent, type UpsertLlmConnectionRequest, type Usage, type UsageDetails, type UserMeta, index$t as annotationQueues, base64Decode, base64Encode, base64ToBytes, index$s as blobStorageIntegrations, bytesToBase64, index$r as comments, index$q as commons, configureGlobalLogger, createExperimentId, createExperimentItemId, createLogger, index$p as datasetItems, index$o as datasetRunItems, index$n as datasets, generateUUID, getEnv, getGlobalLogger, getPropagatedAttributesFromContext, index$m as health, index$l as ingestion, index$h as legacy, index$g as llmConnections, LoggerSingleton as logger, index$f as media, index$e as metrics, index$d as models, index$c as observations, index$b as opentelemetry, index$a as organizations, index$9 as projects, index as promptVersion, index$8 as prompts, propagateAttributes, resetGlobalLogger, safeSetTimeout, index$7 as scim, index$6 as scoreConfigs, index$5 as scores, serializeValue, index$4 as sessions, index$3 as trace, index$1 as utils };
|
|
8614
|
+
export { AccessDeniedError, type AnnotationQueue, type AnnotationQueueAssignmentRequest, type AnnotationQueueItem, AnnotationQueueObjectType, AnnotationQueueStatus, type ApiKeyDeletionResponse, type ApiKeyList, type ApiKeyResponse, type ApiKeySummary, type AuthenticationScheme, type BaseEvent, type BasePrompt, type BaseScore, type BaseScoreV1, BlobStorageExportFrequency, BlobStorageExportMode, type BlobStorageIntegrationDeletionResponse, BlobStorageIntegrationFileType, type BlobStorageIntegrationResponse, type BlobStorageIntegrationStatusResponse, BlobStorageIntegrationType, type BlobStorageIntegrationsResponse, BlobStorageSyncStatus, type BooleanScore, type BooleanScoreV1, type BulkConfig, type CategoricalScore, type CategoricalScoreV1, type ChatMessage, ChatMessageType, type ChatMessageWithPlaceholders, type ChatPrompt, type Comment, CommentObjectType, type ConfigCategory, type CorrectionScore, type CreateAnnotationQueueAssignmentResponse, type CreateAnnotationQueueItemRequest, type CreateAnnotationQueueRequest, type CreateApiKeyRequest, type CreateBlobStorageIntegrationRequest, type CreateChatPromptRequest, CreateChatPromptType, type CreateCommentRequest, type CreateCommentResponse, type CreateDatasetItemRequest, type CreateDatasetRequest, type CreateDatasetRunItemRequest, type CreateEventBody, type CreateEventEvent, type CreateGenerationBody, type CreateGenerationEvent, type CreateModelRequest, type CreateObservationEvent, type CreateProjectRequest, type CreatePromptRequest, type CreateScoreConfigRequest, type CreateScoreValue, type CreateSpanBody, type CreateSpanEvent, type CreateTextPromptRequest, CreateTextPromptType, type CreateUserRequest, type Dataset, type DatasetItem, type DatasetRun, type DatasetRunItem, type DatasetRunWithItems, DatasetStatus, type DeleteAnnotationQueueAssignmentResponse, type DeleteAnnotationQueueItemResponse, type DeleteDatasetItemResponse, type DeleteDatasetRunResponse, type DeleteMembershipRequest, type DeletePromptRequest, type DeleteTraceResponse, type DeleteTracesRequest, type EmptyResponse, Error$1 as Error, type FilterConfig, type GetAnnotationQueueItemsRequest, type GetAnnotationQueuesRequest, type GetCommentsRequest, type GetCommentsResponse, type GetDatasetItemsRequest, type GetDatasetRunsRequest, type GetDatasetsRequest, type GetLlmConnectionsRequest, type GetMediaResponse, type GetMediaUploadUrlRequest, type GetMediaUploadUrlResponse, type GetMetricsV2Request, type GetModelsRequest, type GetObservationsV2Request, type GetPromptRequest, type GetScoreConfigsRequest, type GetScoresRequest, type GetScoresResponse, GetScoresResponseData, type GetScoresResponseDataBoolean, type GetScoresResponseDataCategorical, type GetScoresResponseDataCorrection, type GetScoresResponseDataNumeric, type GetScoresResponseDataText, type GetScoresResponseTraceData, type GetSessionsRequest, type GetTraceRequest, type GetTracesRequest, type HealthResponse, type IngestionError, IngestionEvent, type IngestionRequest, type IngestionResponse, type IngestionSuccess, type IngestionUsage, LANGFUSE_SDK_EXPERIMENT_ENVIRONMENT, LANGFUSE_SDK_NAME, LANGFUSE_SDK_VERSION, LANGFUSE_TRACER_NAME, LANGFUSE_TRACE_ID_BAGGAGE_KEY, LangfuseAPIClient, LangfuseAPIError, LangfuseAPITimeoutError, LangfuseMedia, type LangfuseMediaParams, LangfuseOtelContextKeys, LangfuseOtelSpanAttributes, type ListDatasetRunItemsRequest, type ListPromptsMetaRequest, type ListUsersRequest, LlmAdapter, type LlmConnection, LogLevel, Logger, type LoggerConfig, type MapValue, MediaContentType, type MembershipDeletionResponse, type MembershipRequest, type MembershipResponse, MembershipRole, type MembershipsResponse, MethodNotAllowedError, type MetricsV2Response, type Model, type ModelPrice, ModelUsageUnit, NotFoundError, type NumericScore, type NumericScoreV1, type Observation, type ObservationBody, ObservationLevel, ObservationType, type ObservationV2, type ObservationsV2Meta, type ObservationsV2Response, type ObservationsView, type OpenAiCompletionUsageSchema, type OpenAiResponseUsageSchema, type OpenAiUsage, type OptionalObservationBody, type Organization, type OrganizationApiKey, type OrganizationApiKeysResponse, type OrganizationProject, type OrganizationProjectsResponse, type OtelAttribute, type OtelAttributeValue, type OtelResource, type OtelResourceSpan, type OtelScope, type OtelScopeSpan, type OtelSpan, type OtelTraceRequest, type OtelTraceResponse, type PaginatedAnnotationQueueItems, type PaginatedAnnotationQueues, type PaginatedDatasetItems, type PaginatedDatasetRunItems, type PaginatedDatasetRuns, type PaginatedDatasets, type PaginatedLlmConnections, type PaginatedModels, type PaginatedSessions, type ParsedMediaReference, type PatchMediaBody, type PlaceholderMessage, PlaceholderMessageType, type PricingTier, type PricingTierCondition, type PricingTierInput, PricingTierOperator, type Project, type ProjectDeletionResponse, type Projects$1 as Projects, Prompt, type PromptMeta, type PromptMetaListResponse, PromptType, type PropagateAttributesParams, type ResourceMeta, type ResourceType, type ResourceTypesResponse, type SchemaExtension, type SchemaResource, type SchemasResponse, type ScimEmail, type ScimFeatureSupport, type ScimName, type ScimUser, type ScimUsersListResponse, Score, type ScoreBody, type ScoreConfig, ScoreConfigDataType, type ScoreConfigs$1 as ScoreConfigs, ScoreDataType, type ScoreEvent, ScoreSource, ScoreV1$1 as ScoreV1, type SdkLogBody, type SdkLogEvent, type ServiceProviderConfig, ServiceUnavailableError, type Session, type SessionWithTraces, type Sort, type TextPrompt, type TextScore, type TextScoreV1, type Trace$1 as Trace, type TraceBody, type TraceEvent, type TraceWithDetails, type TraceWithFullDetails, type Traces, UnauthorizedError, type UpdateAnnotationQueueItemRequest, type UpdateEventBody, type UpdateGenerationBody, type UpdateGenerationEvent, type UpdateObservationEvent, type UpdateProjectRequest, type UpdatePromptRequest, type UpdateScoreConfigRequest, type UpdateSpanBody, type UpdateSpanEvent, type UpsertLlmConnectionRequest, type Usage, type UsageDetails, type UserMeta, index$t as annotationQueues, base64Decode, base64Encode, base64ToBytes, index$s as blobStorageIntegrations, bytesToBase64, index$r as comments, index$q as commons, configureGlobalLogger, createExperimentId, createExperimentItemId, createLogger, index$p as datasetItems, index$o as datasetRunItems, index$n as datasets, generateUUID, getEnv, getGlobalLogger, getLangfuseTraceIdFromBaggage, getPropagatedAttributesFromContext, index$m as health, index$l as ingestion, index$h as legacy, index$g as llmConnections, LoggerSingleton as logger, index$f as media, index$e as metrics, index$d as models, index$c as observations, index$b as opentelemetry, index$a as organizations, index$9 as projects, index as promptVersion, index$8 as prompts, propagateAttributes, resetGlobalLogger, safeSetTimeout, index$7 as scim, index$6 as scoreConfigs, index$5 as scores, serializeValue, index$4 as sessions, setLangfuseTraceIdInBaggage, index$3 as trace, index$1 as utils };
|
package/dist/index.d.ts
CHANGED
|
@@ -225,6 +225,7 @@ declare enum LangfuseOtelSpanAttributes {
|
|
|
225
225
|
RELEASE = "langfuse.release",
|
|
226
226
|
VERSION = "langfuse.version",
|
|
227
227
|
AS_ROOT = "langfuse.internal.as_root",
|
|
228
|
+
IS_APP_ROOT = "langfuse.internal.is_app_root",
|
|
228
229
|
EXPERIMENT_ID = "langfuse.experiment.id",
|
|
229
230
|
EXPERIMENT_NAME = "langfuse.experiment.name",
|
|
230
231
|
EXPERIMENT_DESCRIPTION = "langfuse.experiment.description",
|
|
@@ -8422,6 +8423,29 @@ type PropagatedExperimentAttributes = {
|
|
|
8422
8423
|
experimentItemRootObservationId: string;
|
|
8423
8424
|
};
|
|
8424
8425
|
declare const LangfuseOtelContextKeys: Record<PropagatedKey, symbol>;
|
|
8426
|
+
/**
|
|
8427
|
+
* Baggage key used by the SDK to claim that an upstream Langfuse-controlled
|
|
8428
|
+
* scope already exists for a given trace id. Downstream processors read this
|
|
8429
|
+
* to suppress duplicate app-root markers across services.
|
|
8430
|
+
*
|
|
8431
|
+
* @internal
|
|
8432
|
+
*/
|
|
8433
|
+
declare const LANGFUSE_TRACE_ID_BAGGAGE_KEY = "langfuse_trace_id";
|
|
8434
|
+
/**
|
|
8435
|
+
* Reads the Langfuse trace-id app-root claim from the baggage attached to a
|
|
8436
|
+
* context. Returns the lowercased trace id, or undefined if no claim exists.
|
|
8437
|
+
*
|
|
8438
|
+
* @internal
|
|
8439
|
+
*/
|
|
8440
|
+
declare function getLangfuseTraceIdFromBaggage(context: Context): string | undefined;
|
|
8441
|
+
/**
|
|
8442
|
+
* Returns a context that carries the Langfuse trace-id app-root claim in
|
|
8443
|
+
* baggage. If the context already carries the same claim, the original
|
|
8444
|
+
* context is returned unchanged so we don't churn baggage instances.
|
|
8445
|
+
*
|
|
8446
|
+
* @internal
|
|
8447
|
+
*/
|
|
8448
|
+
declare function setLangfuseTraceIdInBaggage(context: Context, traceId: string): Context;
|
|
8425
8449
|
/**
|
|
8426
8450
|
* Parameters for propagateAttributes function.
|
|
8427
8451
|
*
|
|
@@ -8587,4 +8611,4 @@ interface PropagateAttributesParams {
|
|
|
8587
8611
|
declare function propagateAttributes<A extends unknown[], F extends (...args: A) => ReturnType<F>>(params: PropagateAttributesParams, fn: F): ReturnType<F>;
|
|
8588
8612
|
declare function getPropagatedAttributesFromContext(context: Context): Record<string, string | string[]>;
|
|
8589
8613
|
|
|
8590
|
-
export { AccessDeniedError, type AnnotationQueue, type AnnotationQueueAssignmentRequest, type AnnotationQueueItem, AnnotationQueueObjectType, AnnotationQueueStatus, type ApiKeyDeletionResponse, type ApiKeyList, type ApiKeyResponse, type ApiKeySummary, type AuthenticationScheme, type BaseEvent, type BasePrompt, type BaseScore, type BaseScoreV1, BlobStorageExportFrequency, BlobStorageExportMode, type BlobStorageIntegrationDeletionResponse, BlobStorageIntegrationFileType, type BlobStorageIntegrationResponse, type BlobStorageIntegrationStatusResponse, BlobStorageIntegrationType, type BlobStorageIntegrationsResponse, BlobStorageSyncStatus, type BooleanScore, type BooleanScoreV1, type BulkConfig, type CategoricalScore, type CategoricalScoreV1, type ChatMessage, ChatMessageType, type ChatMessageWithPlaceholders, type ChatPrompt, type Comment, CommentObjectType, type ConfigCategory, type CorrectionScore, type CreateAnnotationQueueAssignmentResponse, type CreateAnnotationQueueItemRequest, type CreateAnnotationQueueRequest, type CreateApiKeyRequest, type CreateBlobStorageIntegrationRequest, type CreateChatPromptRequest, CreateChatPromptType, type CreateCommentRequest, type CreateCommentResponse, type CreateDatasetItemRequest, type CreateDatasetRequest, type CreateDatasetRunItemRequest, type CreateEventBody, type CreateEventEvent, type CreateGenerationBody, type CreateGenerationEvent, type CreateModelRequest, type CreateObservationEvent, type CreateProjectRequest, type CreatePromptRequest, type CreateScoreConfigRequest, type CreateScoreValue, type CreateSpanBody, type CreateSpanEvent, type CreateTextPromptRequest, CreateTextPromptType, type CreateUserRequest, type Dataset, type DatasetItem, type DatasetRun, type DatasetRunItem, type DatasetRunWithItems, DatasetStatus, type DeleteAnnotationQueueAssignmentResponse, type DeleteAnnotationQueueItemResponse, type DeleteDatasetItemResponse, type DeleteDatasetRunResponse, type DeleteMembershipRequest, type DeletePromptRequest, type DeleteTraceResponse, type DeleteTracesRequest, type EmptyResponse, Error$1 as Error, type FilterConfig, type GetAnnotationQueueItemsRequest, type GetAnnotationQueuesRequest, type GetCommentsRequest, type GetCommentsResponse, type GetDatasetItemsRequest, type GetDatasetRunsRequest, type GetDatasetsRequest, type GetLlmConnectionsRequest, type GetMediaResponse, type GetMediaUploadUrlRequest, type GetMediaUploadUrlResponse, type GetMetricsV2Request, type GetModelsRequest, type GetObservationsV2Request, type GetPromptRequest, type GetScoreConfigsRequest, type GetScoresRequest, type GetScoresResponse, GetScoresResponseData, type GetScoresResponseDataBoolean, type GetScoresResponseDataCategorical, type GetScoresResponseDataCorrection, type GetScoresResponseDataNumeric, type GetScoresResponseDataText, type GetScoresResponseTraceData, type GetSessionsRequest, type GetTraceRequest, type GetTracesRequest, type HealthResponse, type IngestionError, IngestionEvent, type IngestionRequest, type IngestionResponse, type IngestionSuccess, type IngestionUsage, LANGFUSE_SDK_EXPERIMENT_ENVIRONMENT, LANGFUSE_SDK_NAME, LANGFUSE_SDK_VERSION, LANGFUSE_TRACER_NAME, LangfuseAPIClient, LangfuseAPIError, LangfuseAPITimeoutError, LangfuseMedia, type LangfuseMediaParams, LangfuseOtelContextKeys, LangfuseOtelSpanAttributes, type ListDatasetRunItemsRequest, type ListPromptsMetaRequest, type ListUsersRequest, LlmAdapter, type LlmConnection, LogLevel, Logger, type LoggerConfig, type MapValue, MediaContentType, type MembershipDeletionResponse, type MembershipRequest, type MembershipResponse, MembershipRole, type MembershipsResponse, MethodNotAllowedError, type MetricsV2Response, type Model, type ModelPrice, ModelUsageUnit, NotFoundError, type NumericScore, type NumericScoreV1, type Observation, type ObservationBody, ObservationLevel, ObservationType, type ObservationV2, type ObservationsV2Meta, type ObservationsV2Response, type ObservationsView, type OpenAiCompletionUsageSchema, type OpenAiResponseUsageSchema, type OpenAiUsage, type OptionalObservationBody, type Organization, type OrganizationApiKey, type OrganizationApiKeysResponse, type OrganizationProject, type OrganizationProjectsResponse, type OtelAttribute, type OtelAttributeValue, type OtelResource, type OtelResourceSpan, type OtelScope, type OtelScopeSpan, type OtelSpan, type OtelTraceRequest, type OtelTraceResponse, type PaginatedAnnotationQueueItems, type PaginatedAnnotationQueues, type PaginatedDatasetItems, type PaginatedDatasetRunItems, type PaginatedDatasetRuns, type PaginatedDatasets, type PaginatedLlmConnections, type PaginatedModels, type PaginatedSessions, type ParsedMediaReference, type PatchMediaBody, type PlaceholderMessage, PlaceholderMessageType, type PricingTier, type PricingTierCondition, type PricingTierInput, PricingTierOperator, type Project, type ProjectDeletionResponse, type Projects$1 as Projects, Prompt, type PromptMeta, type PromptMetaListResponse, PromptType, type PropagateAttributesParams, type ResourceMeta, type ResourceType, type ResourceTypesResponse, type SchemaExtension, type SchemaResource, type SchemasResponse, type ScimEmail, type ScimFeatureSupport, type ScimName, type ScimUser, type ScimUsersListResponse, Score, type ScoreBody, type ScoreConfig, ScoreConfigDataType, type ScoreConfigs$1 as ScoreConfigs, ScoreDataType, type ScoreEvent, ScoreSource, ScoreV1$1 as ScoreV1, type SdkLogBody, type SdkLogEvent, type ServiceProviderConfig, ServiceUnavailableError, type Session, type SessionWithTraces, type Sort, type TextPrompt, type TextScore, type TextScoreV1, type Trace$1 as Trace, type TraceBody, type TraceEvent, type TraceWithDetails, type TraceWithFullDetails, type Traces, UnauthorizedError, type UpdateAnnotationQueueItemRequest, type UpdateEventBody, type UpdateGenerationBody, type UpdateGenerationEvent, type UpdateObservationEvent, type UpdateProjectRequest, type UpdatePromptRequest, type UpdateScoreConfigRequest, type UpdateSpanBody, type UpdateSpanEvent, type UpsertLlmConnectionRequest, type Usage, type UsageDetails, type UserMeta, index$t as annotationQueues, base64Decode, base64Encode, base64ToBytes, index$s as blobStorageIntegrations, bytesToBase64, index$r as comments, index$q as commons, configureGlobalLogger, createExperimentId, createExperimentItemId, createLogger, index$p as datasetItems, index$o as datasetRunItems, index$n as datasets, generateUUID, getEnv, getGlobalLogger, getPropagatedAttributesFromContext, index$m as health, index$l as ingestion, index$h as legacy, index$g as llmConnections, LoggerSingleton as logger, index$f as media, index$e as metrics, index$d as models, index$c as observations, index$b as opentelemetry, index$a as organizations, index$9 as projects, index as promptVersion, index$8 as prompts, propagateAttributes, resetGlobalLogger, safeSetTimeout, index$7 as scim, index$6 as scoreConfigs, index$5 as scores, serializeValue, index$4 as sessions, index$3 as trace, index$1 as utils };
|
|
8614
|
+
export { AccessDeniedError, type AnnotationQueue, type AnnotationQueueAssignmentRequest, type AnnotationQueueItem, AnnotationQueueObjectType, AnnotationQueueStatus, type ApiKeyDeletionResponse, type ApiKeyList, type ApiKeyResponse, type ApiKeySummary, type AuthenticationScheme, type BaseEvent, type BasePrompt, type BaseScore, type BaseScoreV1, BlobStorageExportFrequency, BlobStorageExportMode, type BlobStorageIntegrationDeletionResponse, BlobStorageIntegrationFileType, type BlobStorageIntegrationResponse, type BlobStorageIntegrationStatusResponse, BlobStorageIntegrationType, type BlobStorageIntegrationsResponse, BlobStorageSyncStatus, type BooleanScore, type BooleanScoreV1, type BulkConfig, type CategoricalScore, type CategoricalScoreV1, type ChatMessage, ChatMessageType, type ChatMessageWithPlaceholders, type ChatPrompt, type Comment, CommentObjectType, type ConfigCategory, type CorrectionScore, type CreateAnnotationQueueAssignmentResponse, type CreateAnnotationQueueItemRequest, type CreateAnnotationQueueRequest, type CreateApiKeyRequest, type CreateBlobStorageIntegrationRequest, type CreateChatPromptRequest, CreateChatPromptType, type CreateCommentRequest, type CreateCommentResponse, type CreateDatasetItemRequest, type CreateDatasetRequest, type CreateDatasetRunItemRequest, type CreateEventBody, type CreateEventEvent, type CreateGenerationBody, type CreateGenerationEvent, type CreateModelRequest, type CreateObservationEvent, type CreateProjectRequest, type CreatePromptRequest, type CreateScoreConfigRequest, type CreateScoreValue, type CreateSpanBody, type CreateSpanEvent, type CreateTextPromptRequest, CreateTextPromptType, type CreateUserRequest, type Dataset, type DatasetItem, type DatasetRun, type DatasetRunItem, type DatasetRunWithItems, DatasetStatus, type DeleteAnnotationQueueAssignmentResponse, type DeleteAnnotationQueueItemResponse, type DeleteDatasetItemResponse, type DeleteDatasetRunResponse, type DeleteMembershipRequest, type DeletePromptRequest, type DeleteTraceResponse, type DeleteTracesRequest, type EmptyResponse, Error$1 as Error, type FilterConfig, type GetAnnotationQueueItemsRequest, type GetAnnotationQueuesRequest, type GetCommentsRequest, type GetCommentsResponse, type GetDatasetItemsRequest, type GetDatasetRunsRequest, type GetDatasetsRequest, type GetLlmConnectionsRequest, type GetMediaResponse, type GetMediaUploadUrlRequest, type GetMediaUploadUrlResponse, type GetMetricsV2Request, type GetModelsRequest, type GetObservationsV2Request, type GetPromptRequest, type GetScoreConfigsRequest, type GetScoresRequest, type GetScoresResponse, GetScoresResponseData, type GetScoresResponseDataBoolean, type GetScoresResponseDataCategorical, type GetScoresResponseDataCorrection, type GetScoresResponseDataNumeric, type GetScoresResponseDataText, type GetScoresResponseTraceData, type GetSessionsRequest, type GetTraceRequest, type GetTracesRequest, type HealthResponse, type IngestionError, IngestionEvent, type IngestionRequest, type IngestionResponse, type IngestionSuccess, type IngestionUsage, LANGFUSE_SDK_EXPERIMENT_ENVIRONMENT, LANGFUSE_SDK_NAME, LANGFUSE_SDK_VERSION, LANGFUSE_TRACER_NAME, LANGFUSE_TRACE_ID_BAGGAGE_KEY, LangfuseAPIClient, LangfuseAPIError, LangfuseAPITimeoutError, LangfuseMedia, type LangfuseMediaParams, LangfuseOtelContextKeys, LangfuseOtelSpanAttributes, type ListDatasetRunItemsRequest, type ListPromptsMetaRequest, type ListUsersRequest, LlmAdapter, type LlmConnection, LogLevel, Logger, type LoggerConfig, type MapValue, MediaContentType, type MembershipDeletionResponse, type MembershipRequest, type MembershipResponse, MembershipRole, type MembershipsResponse, MethodNotAllowedError, type MetricsV2Response, type Model, type ModelPrice, ModelUsageUnit, NotFoundError, type NumericScore, type NumericScoreV1, type Observation, type ObservationBody, ObservationLevel, ObservationType, type ObservationV2, type ObservationsV2Meta, type ObservationsV2Response, type ObservationsView, type OpenAiCompletionUsageSchema, type OpenAiResponseUsageSchema, type OpenAiUsage, type OptionalObservationBody, type Organization, type OrganizationApiKey, type OrganizationApiKeysResponse, type OrganizationProject, type OrganizationProjectsResponse, type OtelAttribute, type OtelAttributeValue, type OtelResource, type OtelResourceSpan, type OtelScope, type OtelScopeSpan, type OtelSpan, type OtelTraceRequest, type OtelTraceResponse, type PaginatedAnnotationQueueItems, type PaginatedAnnotationQueues, type PaginatedDatasetItems, type PaginatedDatasetRunItems, type PaginatedDatasetRuns, type PaginatedDatasets, type PaginatedLlmConnections, type PaginatedModels, type PaginatedSessions, type ParsedMediaReference, type PatchMediaBody, type PlaceholderMessage, PlaceholderMessageType, type PricingTier, type PricingTierCondition, type PricingTierInput, PricingTierOperator, type Project, type ProjectDeletionResponse, type Projects$1 as Projects, Prompt, type PromptMeta, type PromptMetaListResponse, PromptType, type PropagateAttributesParams, type ResourceMeta, type ResourceType, type ResourceTypesResponse, type SchemaExtension, type SchemaResource, type SchemasResponse, type ScimEmail, type ScimFeatureSupport, type ScimName, type ScimUser, type ScimUsersListResponse, Score, type ScoreBody, type ScoreConfig, ScoreConfigDataType, type ScoreConfigs$1 as ScoreConfigs, ScoreDataType, type ScoreEvent, ScoreSource, ScoreV1$1 as ScoreV1, type SdkLogBody, type SdkLogEvent, type ServiceProviderConfig, ServiceUnavailableError, type Session, type SessionWithTraces, type Sort, type TextPrompt, type TextScore, type TextScoreV1, type Trace$1 as Trace, type TraceBody, type TraceEvent, type TraceWithDetails, type TraceWithFullDetails, type Traces, UnauthorizedError, type UpdateAnnotationQueueItemRequest, type UpdateEventBody, type UpdateGenerationBody, type UpdateGenerationEvent, type UpdateObservationEvent, type UpdateProjectRequest, type UpdatePromptRequest, type UpdateScoreConfigRequest, type UpdateSpanBody, type UpdateSpanEvent, type UpsertLlmConnectionRequest, type Usage, type UsageDetails, type UserMeta, index$t as annotationQueues, base64Decode, base64Encode, base64ToBytes, index$s as blobStorageIntegrations, bytesToBase64, index$r as comments, index$q as commons, configureGlobalLogger, createExperimentId, createExperimentItemId, createLogger, index$p as datasetItems, index$o as datasetRunItems, index$n as datasets, generateUUID, getEnv, getGlobalLogger, getLangfuseTraceIdFromBaggage, getPropagatedAttributesFromContext, index$m as health, index$l as ingestion, index$h as legacy, index$g as llmConnections, LoggerSingleton as logger, index$f as media, index$e as metrics, index$d as models, index$c as observations, index$b as opentelemetry, index$a as organizations, index$9 as projects, index as promptVersion, index$8 as prompts, propagateAttributes, resetGlobalLogger, safeSetTimeout, index$7 as scim, index$6 as scoreConfigs, index$5 as scores, serializeValue, index$4 as sessions, setLangfuseTraceIdInBaggage, index$3 as trace, index$1 as utils };
|
package/dist/index.mjs
CHANGED
|
@@ -276,7 +276,7 @@ var resetGlobalLogger = () => {
|
|
|
276
276
|
// package.json
|
|
277
277
|
var package_default = {
|
|
278
278
|
name: "@langfuse/core",
|
|
279
|
-
version: "5.
|
|
279
|
+
version: "5.4.0-beta.1",
|
|
280
280
|
description: "Core functions and utilities for Langfuse packages",
|
|
281
281
|
type: "module",
|
|
282
282
|
sideEffects: false,
|
|
@@ -347,6 +347,7 @@ var LangfuseOtelSpanAttributes = /* @__PURE__ */ ((LangfuseOtelSpanAttributes2)
|
|
|
347
347
|
LangfuseOtelSpanAttributes2["RELEASE"] = "langfuse.release";
|
|
348
348
|
LangfuseOtelSpanAttributes2["VERSION"] = "langfuse.version";
|
|
349
349
|
LangfuseOtelSpanAttributes2["AS_ROOT"] = "langfuse.internal.as_root";
|
|
350
|
+
LangfuseOtelSpanAttributes2["IS_APP_ROOT"] = "langfuse.internal.is_app_root";
|
|
350
351
|
LangfuseOtelSpanAttributes2["EXPERIMENT_ID"] = "langfuse.experiment.id";
|
|
351
352
|
LangfuseOtelSpanAttributes2["EXPERIMENT_NAME"] = "langfuse.experiment.name";
|
|
352
353
|
LangfuseOtelSpanAttributes2["EXPERIMENT_DESCRIPTION"] = "langfuse.experiment.description";
|
|
@@ -12368,6 +12369,23 @@ var LangfuseOtelContextKeys = {
|
|
|
12368
12369
|
};
|
|
12369
12370
|
var LANGFUSE_BAGGAGE_PREFIX = "langfuse_";
|
|
12370
12371
|
var LANGFUSE_BAGGAGE_TAGS_SEPARATOR = ",";
|
|
12372
|
+
var LANGFUSE_TRACE_ID_BAGGAGE_KEY = "langfuse_trace_id";
|
|
12373
|
+
function getLangfuseTraceIdFromBaggage(context) {
|
|
12374
|
+
const baggage = propagation.getBaggage(context);
|
|
12375
|
+
const entry = baggage == null ? void 0 : baggage.getEntry(LANGFUSE_TRACE_ID_BAGGAGE_KEY);
|
|
12376
|
+
if (!(entry == null ? void 0 : entry.value)) return void 0;
|
|
12377
|
+
return entry.value.toLowerCase();
|
|
12378
|
+
}
|
|
12379
|
+
function setLangfuseTraceIdInBaggage(context, traceId) {
|
|
12380
|
+
var _a2;
|
|
12381
|
+
const normalized = traceId.toLowerCase();
|
|
12382
|
+
if (getLangfuseTraceIdFromBaggage(context) === normalized) return context;
|
|
12383
|
+
const baggage = (_a2 = propagation.getBaggage(context)) != null ? _a2 : propagation.createBaggage();
|
|
12384
|
+
const updated = baggage.setEntry(LANGFUSE_TRACE_ID_BAGGAGE_KEY, {
|
|
12385
|
+
value: normalized
|
|
12386
|
+
});
|
|
12387
|
+
return propagation.setBaggage(context, updated);
|
|
12388
|
+
}
|
|
12371
12389
|
function propagateAttributes(params, fn) {
|
|
12372
12390
|
var _a2;
|
|
12373
12391
|
let context = otelContextApi.active();
|
|
@@ -12492,6 +12510,7 @@ function getPropagatedAttributesFromContext(context) {
|
|
|
12492
12510
|
const baggage = propagation.getBaggage(context);
|
|
12493
12511
|
if (baggage) {
|
|
12494
12512
|
baggage.getAllEntries().forEach(([baggageKey, baggageEntry]) => {
|
|
12513
|
+
if (baggageKey === LANGFUSE_TRACE_ID_BAGGAGE_KEY) return;
|
|
12495
12514
|
if (baggageKey.startsWith(LANGFUSE_BAGGAGE_PREFIX)) {
|
|
12496
12515
|
const spanKey = getSpanKeyFromBaggageKey(baggageKey);
|
|
12497
12516
|
if (spanKey) {
|
|
@@ -12752,6 +12771,7 @@ export {
|
|
|
12752
12771
|
LANGFUSE_SDK_NAME,
|
|
12753
12772
|
LANGFUSE_SDK_VERSION,
|
|
12754
12773
|
LANGFUSE_TRACER_NAME,
|
|
12774
|
+
LANGFUSE_TRACE_ID_BAGGAGE_KEY,
|
|
12755
12775
|
LangfuseAPIClient,
|
|
12756
12776
|
LangfuseAPIError,
|
|
12757
12777
|
LangfuseAPITimeoutError,
|
|
@@ -12794,6 +12814,7 @@ export {
|
|
|
12794
12814
|
generateUUID,
|
|
12795
12815
|
getEnv,
|
|
12796
12816
|
getGlobalLogger,
|
|
12817
|
+
getLangfuseTraceIdFromBaggage,
|
|
12797
12818
|
getPropagatedAttributesFromContext,
|
|
12798
12819
|
health_exports as health,
|
|
12799
12820
|
ingestion_exports as ingestion,
|
|
@@ -12817,6 +12838,7 @@ export {
|
|
|
12817
12838
|
scores_exports as scores,
|
|
12818
12839
|
serializeValue,
|
|
12819
12840
|
sessions_exports as sessions,
|
|
12841
|
+
setLangfuseTraceIdInBaggage,
|
|
12820
12842
|
trace_exports as trace,
|
|
12821
12843
|
utils_exports as utils
|
|
12822
12844
|
};
|