* style(annotation): validate numbers in annotation onKeyUp
* style(drawer): round top left corner
* style: mark discard comment as destructive
* refactor: extract config categories to type in shared
* style: improve annotation range display in configs table
* style: ensure form caters to a lot of categories
* style: show entire description on screen
* style(scores_table): allow hiding author
* push
* push
* push
* push
* perf(sessions): improve `filterOptions` api
* limit to 1000 results
* fix: remove unintentional line from `traces.filterOptions`
* feat(table_filters): add free text search option
* push
* show custom select option in `userIds` column on sessions table
* style: fix padding
* style: improve styling
* simplify
* push
* feat(multi-select): show `customSelect` also when "no results found"
* improve ux across delete buttons
* updated delete button on models screen
* trpc errors are logged to console by default
* revert to pointer-events-none on disabled button
---------
Co-authored-by: Mish Ushakov <mishushakov@users.noreply.github.com>
Co-authored-by: Marc Klingen <git@marcklingen.com>
* feat: add timestamp filter to user table
* users table definition instead of reusing traces
* add filter to total as well to make table state consistent
---------
Co-authored-by: Marc Klingen <git@marcklingen.com>
* feat: add author user id column to scores table
* feat: add author user id to scores created via trpc router
* feat: add author user id to scores created in seeder
* fixup
* add: index to author user id on scores
* feat: annotation config schema
* add: migration
* add: migrations in order
* fixup after merge
* fix: replicate to worker/types
* fix: address feedback
* rn: to scoreConfig
* push
* refactor: rn `ScoreDataType` to `ScoreConfigDataType`
* fix
* fix: scores server test
* context: order of returned data can vary based on how data is retrieved. Likely re-ordered due to new index on configId in scores table
* fix: re-generate types for correct alphabetical order
* fix: remodel migrations to match new schema
* feat: rm backfill migration for data_type on scores
* make data_type column optional on scores
* push: regenerate types
* push
* feat: make dataType on scores required again
* rename: scores add data type migration
* re-run migrations
* push
* feat: add author user id column to scores table
* feat: add author user id to scores created via trpc router
* feat: add author user id to scores created in seeder
* fixup
* add: index to author user id on scores
* replicate to worker/types
---------
Co-authored-by: Marc Klingen <git@marcklingen.com>
* feat: move scores on trace and observation preview to different tab
* refactor: extract current table logic into `ScoresTablePreview`
* fix: rm unused footer
* refactor: scores preview table
* fix: tab state needs to be reset upon changing currentObservationId
* refactor: reorder for readability
* refactor: rm column visibility as not needed
* fix: rm pagination
* refactor: rn details to preview
* feat: restyle tabs
* feat: reuse scores table
* feat: hide columns
* feat: add source column to scores table
* feat: add user name and avatar to scores table
* adjust seeder
* feat: show score value in preview tab
* fix: don't show comment if empty string
* feat: add score source to preview UI
* feat: add tooltip
* feat: don't use user image and name in scores table
* feat: hide userId column in trace and observation preview
* adjust seeder to reuse image in bucket
* fix: pass table name to save column visibility in local storage
* revert: changes to seed file
* feat: misc UI improvements
* fixup: first draft add `is not` filter to table
* feat: show all nested scores for trace scores
* fix: misc UI
* ui: use `primary-accent` color
* adjust padding/margins
* adjust paddings
---------
Co-authored-by: Marc Klingen <git@marcklingen.com>
* feat: add number of observations as new col on traces
* perf: load `observationCount` directly
* feat: show generations table per prompt version
* feat: remove `isHideIfEmptyEnabled` config
* fix: remove `enableSorting` for `observationCount`
description:Describe how to reproduce your bug. Steps, code snippets, reproduction repos etc.
description:Describe how to reproduce your bug. Please provide detailed steps, code snippets, reproduction repos etc.
validations:
required:true
- type:textarea
attributes:
label:SDK and container versions
description:If you're experiencing an issue with an integration or SDK, please ensure you're using the latest version. If you're self-hosting Langfuse, check that you're running the most recent version. If updating isn't an option, please provide the specific versions you're currently using.
- type:textarea
attributes:
label:Additional information
description:Add any other information related to the bug here, screenshots if applicable.
- type:dropdown
id:contribute
attributes:
label:Are you interested to contribute a fix for this bug?
description:If this is a confirmed bug, the maintainers are happy to support with guidance and review.
The diagram below may not show all relationships if the foreign key is not defined in the database schema. For instance, `trace_id` in the `observation` table is not defined as a foreign key to the `trace` table to allow unordered ingestion of these objects, but it is still a foreign key in the application code.
Full database schema: [packages/shared/prisma/schema.prisma](packages/shared/prisma/schema.prisma)
<img src="./packages/shared/prisma/database.svg">
### Infrastructure & Network Overview
> [!NOTE]
> This will change in Langfuse version 3.0. More in the [GitHub Discussions](https://github.com/orgs/langfuse/discussions/1902).
```mermaid
flowchart LR
@@ -114,15 +124,25 @@ flowchart LR
App --- DB
```
### Database Overview
The diagram below may not show all relationships if the foreign key is not defined in the database schema. For instance, `trace_id` in the `observation` table is not defined as a foreign key to the `trace` table to allow unordered ingestion of these objects, but it is still a foreign key in the application code.
Full database schema: [packages/shared/prisma/schema.prisma](packages/shared/prisma/schema.prisma)
<img src="./packages/shared/prisma/database.svg">
## Repository Structure
We built a monorepo using [pnpm](https://pnpm.io/motivation) and [turbo](https://turbo.build/repo/docs) to manage the dependencies and build process. The monorepo contains the following packages:
-`web`: is the main application package providing Frontend and Backend APIs for Langfuse.
-`worker` (no production yet): contains an application for asynchronous processing of tasks. This package is not yet used in production.
-`shared`: contains shared code between the above packages.
-`config-eslint`: contains eslint configurations which are shared between the above packages.
-`config-typescript`: contains typescript configurations which are shared between the above packages.
-`packages`:
-`shared`: contains shared code between the above packages.
-`config-eslint`: contains eslint configurations which are shared between the above packages.
-`config-typescript`: contains typescript configurations which are shared between the above packages.
-`ee`: contains all enterprise features. See [EE README](ee/README.md) for more details.
## Development Setup
@@ -131,9 +151,11 @@ Requirements
- Node.js 20 as specified in the [.nvmrc](.nvmrc)
- Docker to run the database locally
**Note:** You can also simply run Langfuse in a **GitHub Codespace** via the provided devcontainer. To do this, click on the green "Code" button in the top right corner of the repository and select "Open with Codespaces".
**Steps**
1. Fork the the repository and clone it locally
1. Fork the repository and clone it locally
2. Run the development database
```bash
@@ -171,6 +193,16 @@ Requirements
pnpm run dev
```
7. Open the web app in the browser:
http://localhost:3000
8. Log in as a test user (after you ran `db:seed` command):
Username: demo@langfuse.com
Password: password
## Monorepo quickstart
- Available packages and their dependencies
@@ -270,6 +302,86 @@ When a new release is tagged on the `main` branch (excluding prereleases), it tr
1. The Docker image is published to GitHub Packages with the version number and `latest` tag.
2. The deployment is carried out on Langfuse Cloud. This is done by force pushing the `main` branch to the `production` branch during every release, using the [`release.yml`](.github/workflows/release.yml) GitHub Action.
## Theming
At Langfuse, we utilize CSS variables to manage our theme settings across the platform.
Our approach leverages separate CSS variables for backgrounds (--background) and foregrounds (--foreground), fully adhering to the [shadcn/ui](https://ui.shadcn.com/docs/theming) color conventions. The background suffix can be omitted if the variable is used for the background color of the component. We recommend using HSL values for these colors to enhance consistency and customization. There is no need to manually handle dark mode styling with "dark:" prefixes, as next-themes automatically manages the theme switching.
Given the following CSS variables:
```
--primary: 222.2 47.4% 11.2%; // e.g. background-color
--primary-foreground: 210 40% 98%; // e.g. text-color
```
The background color of the following component will be `hsl(var(--primary))` and the foreground color will be `hsl(var(--primary-foreground))`.
Portions of this software are licensed as follows:
* All content that resides under the "ee/" directory of this repository, if that directory exists, is licensed under the license defined in "ee/LICENSE".
* All third party components incorporated into the Finto Technologies Software are licensed under the original license provided by the owner of the applicable component.
* Content outside of the above mentioned directories or restrictions above is available under the "MIT Expat" license as defined below.
- All content that resides under the "ee/" and/or "web/src/ee" directories of this repository, if these directories exist, is licensed under the license defined in "ee/LICENSE".
- All third party components incorporated into the Finto Technologies Software are licensed under the original license provided by the owner of the applicable component.
- Content outside of the above mentioned directories or restrictions above is available under the "MIT Expat" license as defined below.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@@ -22,4 +22,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
<span>Langfuse uses <a href="https://github.com/orgs/langfuse/discussions"><strong>Github Discussions</strong></a> for Support and Feature Requests.</span>
<br/>
<span>We're hiring. <a href="https://langfuse.com/careers"><strong>Join us</strong></a> in Backend Engineering, Product Engineering, and Developer Relations.</span>
- **Observability:** Instrument your app and start ingesting traces to Langfuse ([Quickstart](https://langfuse.com/docs/get-started), [Integrations](https://langfuse.com/docs/integrations) [Tracing](https://langfuse.com/docs/tracing))
- **Langfuse UI:** Inspect and debug complex logs ([Demo](https://langfuse.com/docs/demo), [Tracing](https://langfuse.com/docs/tracing))
- **Prompts:** Manage, version and deploy prompts from within Langfuse ([Prompt Management](https://langfuse.com/docs/prompts))
- **Prompt Management:** Manage, version and deploy prompts from within Langfuse ([Prompt Management](https://langfuse.com/docs/prompts/get-started))
- **Prompt Engineering:** Test and iterate on your prompts with the [LLM Playground](https://langfuse.com/docs/playground)
### Monitor
- **Analytics:** Track metrics (cost, latency, quality) and gain insights from dashboards & data exports ([Analytics](https://langfuse.com/docs/analytics))
- **Evals:** Collect and calculate scores for your LLM completions ([Scores & Evaluations](https://langfuse.com/docs/scores))
- Run model-based evaluations ([Model-based evaluations](https://langfuse.com/docs/scores/model-based-evals))
- Run model-based evaluations ([Model-based evaluations](https://langfuse.com/docs/scores/model-based-evals)) within Langfuse
- Collect user feedback ([User Feedback](https://langfuse.com/docs/scores/user-feedback))
- Manually score observations in Langfuse ([Manual Scores](https://langfuse.com/docs/scores/manually))
@@ -101,22 +108,26 @@ See the [→ Quickstart](https://langfuse.com/docs/get-started) to integrate Lan
| [LiteLLM](/docs/integrations/litellm) | Python, JS/TS (proxy only) | Use any LLM as a drop in replacement for GPT. Use Azure, OpenAI, Cohere, Anthropic, Ollama, VLLM, Sagemaker, HuggingFace, Replicate (100+ LLMs). |
| [API](/docs/api) | | Directly call the public API. OpenAPI spec available. |
External projects/packages that integrate with Langfuse:
| [LiteLLM](https://langfuse.com/docs/integrations/litellm) | Use any LLM as a drop in replacement for GPT. Use Azure, OpenAI, Cohere, Anthropic, Ollama, VLLM, Sagemaker, HuggingFace, Replicate (100+ LLMs). |
| [Langflow](https://langfuse.com/docs/integrations/langflow) | Python-based UI for LangChain, designed with react-flow to provide an effortless way to experiment and prototype flows. |
| [Superagent](https://langfuse.com/docs/integrations/superagent) | Open Source AI Assistant Framework & API for prototyping and deployment of agents. |
| [Langflow](/docs/integrations/langflow) | Python-based UI for LangChain, designed with react-flow to provide an effortless way to experiment and prototype flows. |
| [Superagent](/docs/integrations/superagent) | Open Source AI Assistant Framework & API for prototyping and deployment of agents. |
## Questions and feedback
@@ -142,13 +153,13 @@ In order of preference the best way to communicate with us:
## License
This repository is MIT licensed, except for the `ee/` folder. See [LICENSE](LICENSE) and [docs](https://langfuse.com/docs/open-source) for more details.
This repository is MIT licensed, except for the `ee` folders. See [LICENSE](LICENSE) and [docs](https://langfuse.com/docs/open-source) for more details.
## Misc
### GET API to export your data
[**GET routes**](https://langfuse.com/docs/integrations/api) to use data in downstream applications (e.g. embedded analytics).
[**GET routes**](https://langfuse.com/docs/integrations/api) to use data in downstream applications (e.g. embedded analytics). You can also access them conveniently via the SDKs ([docs](https://langfuse.com/docs/query-traces)).
While we are currently working 100% on the open source version, we consider financing the project by developing some premium features as part of an enterprise version under a commercial license. Please reach out to us if you have specific requirements: enterprise@langfuse.com
This folder includes features that are only available in the Enterprise Edition of Langfuse and on Langfuse Cloud.
See [LICENSE](../LICENSE) and [docs](https://langfuse.com/docs/open-source) for more details.
docs:The value of the score. Must be passed as string for categorical scores, and numeric for boolean and numeric scores. Boolean score values must equal either 1 or 0 (true or false)
observationId:optional<string>
comment:optional<string>
Score:
dataType:
type:optional<ScoreDataType>
docs:When set, must match the score value's type. If not set, will be inferred from the score value or config
configId:
type:optional<string>
docs:Reference a score config on a score. When set, the score name must equal the config name and scores must comply with the config's range and data type. For categorical scores, the value must map to a config category. Numeric scores might be constrained by the score config's max and min values
examples:
- value:
name:"novelty"
value:0.9
traceId:"cdef-1234-5678-90ab"
- value:
name:"consistency"
value:1.2
dataType:"NUMERIC"
traceId:"cdef-1234-5678-90ab"
- value:
name:"accuracy"
value:0.9
dataType:"NUMERIC"
configId:"9203-4567-89ab-cdef"
traceId:"cdef-1234-5678-90ab"
- value:
name:"toxicity"
value:"not toxic"
traceId:"cdef-1234-5678-90ab"
- value:
name:"correctness"
value:"partially correct"
dataType:"CATEGORICAL"
configId:"1234-5678-90ab-cdef"
traceId:"cdef-1234-5678-90ab"
- value:
name:"hallucination"
value:0
dataType:"BOOLEAN"
traceId:"cdef-1234-5678-90ab"
- value:
name:"helpfulness"
value:1
dataType:"BOOLEAN"
configId:"1234-5678-90ab-cdef"
traceId:"cdef-1234-5678-90ab"
BaseScore:
properties:
id:string
traceId:string
name:string
value:double
source:ScoreSource
observationId:optional<string>
timestamp:datetime
createdAt:datetime
updatedAt:datetime
authorUserId:optional<string>
comment:optional<string>
configId:
type:optional<string>
docs:Reference a score config on a score. When set, config and score name must be equal and value must comply to optionally defined numerical range
NumericScore:
extends:BaseScore
properties:
value:
type:double
docs:The numeric value of the score
BooleanScore:
extends:BaseScore
properties:
value:
type:double
docs:The numeric value of the score. Equals 1 for "True" and 0 for "False"
stringValue:
type:string
docs:The string representation of the score value. Is inferred from the numeric value and equals "True" or "False"
CategoricalScore:
extends:BaseScore
properties:
value:
type:optional<double>
docs:Only defined if a config is linked. Represents the numeric category mapping of the stringValue
stringValue:
type:string
docs:The string representation of the score value. If no config is linked, can be any string. Otherwise, must map to a config category
Score:
discriminant:"dataType"
union:
NUMERIC:
type:NumericScore
docs:"Score with NUMERIC data type"
CATEGORICAL:
type:CategoricalScore
docs:"Score with CATEGORICAL data type"
BOOLEAN:
type:BooleanScore
docs:"Score with BOOLEAN data type"
ScoreSource:
enum:
- ANNOTATION
- API
- EVAL
ScoreDataType:
enum:
- NUMERIC
- CATEGORICAL
- BOOLEAN
CreateScoreValue:
discriminated:false
union:
- double
- string
docs:The value of the score. Must be passed as string for categorical scores, and numeric for boolean and numeric scores
docs:Whether the score config is archived. Defaults to false
minValue:
type:optional<double>
docs:Sets minimum value for numerical scores. If not set, the minimum value defaults to -∞
maxValue:
type:optional<double>
docs:Sets maximum value for numerical scores. If not set, the maximum value defaults to +∞
categories:
type:optional<list<ConfigCategory>>
docs:Configures custom categories for categorical scores
description:optional<string>
ConfigCategory:
properties:
value:double
label:string
BaseScore:
properties:
id:string
traceId:string
name:string
value:double
source:ScoreSource
observationId:optional<string>
timestamp:datetime
createdAt:datetime
updatedAt:datetime
authorUserId:optional<string>
comment:optional<string>
DatasetCore:
configId:
type:optional<string>
docs:Reference a score config on a score. When set, config and score name must be equal and value must comply to optionally defined numerical range
NumericScore:
extends:BaseScore
properties:
value:
type:double
docs:The numeric value of the score
BooleanScore:
extends:BaseScore
properties:
value:
type:double
docs:The numeric value of the score. Equals 1 for "True" and 0 for "False"
stringValue:
type:string
docs:The string representation of the score value. Is inferred from the numeric value and equals "True" or "False"
CategoricalScore:
extends:BaseScore
properties:
value:
type:optional<double>
docs:Only defined if a config is linked. Represents the numeric category mapping of the stringValue
stringValue:
type:string
docs:The string representation of the score value. If no config is linked, can be any string. Otherwise, must map to a config category
Score:
discriminant:"dataType"
union:
NUMERIC:
type:NumericScore
docs:"Score with NUMERIC data type"
CATEGORICAL:
type:CategoricalScore
docs:"Score with CATEGORICAL data type"
BOOLEAN:
type:BooleanScore
docs:"Score with BOOLEAN data type"
CreateScoreValue:
discriminated:false
union:
- double
- string
docs:The value of the score. Must be passed as string for categorical scores, and numeric for boolean and numeric scores
Dataset:
properties:
id:string
name:string
description:optional<string>
metadata:optional<unknown>
projectId:string
createdAt:datetime
updatedAt:datetime
DatasetWithReferences:# GET datasets
extends:DatasetCore
properties:
items:
type:list<string>
docs:list of dataset item ids
runs:
type:list<string>
docs:list of dataset run names
Dataset:# GET datasets/[name]
docs:Dataset including all items
extends:DatasetCore
properties:
items:list<DatasetItem>
runs:list<string>
DatasetItem:
properties:
id:string
status:DatasetStatus
input:optional<unknown>
expectedOutput:optional<unknown>
metadata:optional<unknown>
sourceTraceId:optional<string>
sourceObservationId:optional<string>
datasetId:string
@@ -177,7 +245,43 @@ types:
datasetName:string
createdAt:datetime
updatedAt:datetime
DatasetRunWithItems:
extends:DatasetRun
properties:
datasetRunItems:list<DatasetRunItem>
Model:
docs:Model definition used for transforming usage into USD cost and/or tokenization.
properties:
id:string
modelName:
docs:"Name of the model definition. If multiple with the same name exist, they are applied in the following order: (1) custom over built-in, (2) newest according to startTime where model.startTime<observation.startTime"
type:string
matchPattern:
docs:"Regex pattern which matches this model definition to generation.model. Useful in case of fine-tuned models. If you want to exact match, use `(?i)^modelname$`"
type:string
startDate:
docs:Apply only to generations which are newer than this ISO date.
type:optional<date>
unit:
docs:Unit used by this model.
type:ModelUsageUnit
inputPrice:
docs:Price (USD) per input unit
type:optional<double>
outputPrice:
docs:Price (USD) per output unit
type:optional<double>
totalPrice:
docs:Price (USD) per total unit. Cannot be set if input or output price is set.
type:optional<double>
tokenizerId:
docs:Optional. Tokenizer to be applied to observations which match to this model. See docs for more details.
type:optional<string>
tokenizerConfig:
docs:Optional. Configuration for the selected tokenizer. Needs to be JSON. See docs for more details.
Batched ingestion for Langfuse Tracing. If you want to use tracing via the API, such as to build your own Langfuse client implementation, this is the only API route you need to implement.
Notes:
- Batch sizes are limited to 3.5 MB in total. You need to adjust the number of events per batch accordingly.
- The API does not return a 4xx status code for input errors. Instead, it responds with a 207 status code, which includes a list of the encountered errors.
method:POST
path:/ingestion
request:
name:IngestionRequest
body:
properties:
batch:list<IngestionEvent>
response:IngestionResponse# will be reportet as 200 response, but endpoint returns 207
batch:
type:list<IngestionEvent>
docs:"Batch of tracing events to be ingested. Discriminated by attribute `type`."
metadata:
type:optional<unknown>
docs:Optional. Metadata field used by the Langfuse SDKs for debugging.
response:
type:IngestionResponse
status-code:207
types:
IngestionEvent:
discriminant:"type"
union:
trace-create:TraceEvent
score-create:ScoreEvent
event-create:CreateEventEvent
generation-create:CreateGenerationEvent
generation-update:UpdateGenerationEvent
span-create:CreateSpanEvent
span-update:UpdateSpanEvent
sdk-log:SDKLogEvent
trace-create:
type:TraceEvent
docs:Creates a new trace. Upserts on id for updates if trace with id exists.
score-create:
type:ScoreEvent
docs:Creates a new score. Upserts on id for updates if score with id exists.
span-create:
type:CreateSpanEvent
docs:Creates a new span.
span-update:
type:UpdateSpanEvent
docs:Updates span based on id.
generation-create:
type:CreateGenerationEvent
docs:Creates a new generation.
generation-update:
type:UpdateGenerationEvent
docs:Updates a generation based on id.
event-create:
type:CreateEventEvent
docs:Creates an event.
sdk-log:
type:SDKLogEvent
docs:Langfuse SDKs only, used for debugging purposes.
# both are legacy
observation-create:
@@ -156,15 +185,66 @@ types:
id:optional<string>
traceId:string
name:string
value:double
value:
type:commons.CreateScoreValue
docs:The value of the score. Must be passed as string for categorical scores, and numeric for boolean and numeric scores. Boolean score values must equal either 1 or 0 (true or false)
observationId:optional<string>
comment:optional<string>
dataType:
type:optional<commons.ScoreDataType>
docs:When set, must match the score value's type. If not set, will be inferred from the score value or config
configId:
type:optional<string>
docs:Reference a score config on a score. When set, the score name must equal the config name and scores must comply with the config's range and data type. For categorical scores, the value must map to a config category. Numeric scores might be constrained by the score config's max and min values
examples:
- value:
name:"novelty"
value:0.9
traceId:"cdef-1234-5678-90ab"
- value:
name:"consistency"
value:1.2
dataType:"NUMERIC"
traceId:"cdef-1234-5678-90ab"
- value:
name:"accuracy"
value:0.9
dataType:"NUMERIC"
configId:"9203-4567-89ab-cdef"
traceId:"cdef-1234-5678-90ab"
- value:
name:"toxicity"
value:"not toxic"
traceId:"cdef-1234-5678-90ab"
- value:
name:"correctness"
value:"partially correct"
dataType:"CATEGORICAL"
configId:"1234-5678-90ab-cdef"
traceId:"cdef-1234-5678-90ab"
- value:
name:"hallucination"
value:0
dataType:"BOOLEAN"
traceId:"cdef-1234-5678-90ab"
- value:
name:"helpfulness"
value:1
dataType:"BOOLEAN"
configId:"1234-5678-90ab-cdef"
traceId:"cdef-1234-5678-90ab"
BaseEvent:
properties:
id:string
timestamp:string
metadata:unknown
id:
type:string
docs:UUID v4 that identifies the event
timestamp:
type:string
docs:"Datetime (ISO 8601) of event creation in client. Should be as close to actual event creation in client as possible, this timestamp will be used for ordering of events in future release. Resolution: milliseconds (required), microseconds (optimal)."
metadata:
type:optional<unknown>
docs:Optional. Metadata field used by the Langfuse SDKs for debugging.
docs:Delete a model. Cannot delete models managed by Langfuse. You can create your own definition with the same modelName to override the definition though.
path:/models/{id}
path-parameters:
id:string
types:
PaginatedModels:
properties:
data:list<commons.Model>
meta:pagination.MetaResponse
CreateModelRequest:
properties:
modelName:
docs:"Name of the model definition. If multiple with the same name exist, they are applied in the following order: (1) custom over built-in, (2) newest according to startTime where model.startTime<observation.startTime"
type:string
matchPattern:
docs:"Regex pattern which matches this model definition to generation.model. Useful in case of fine-tuned models. If you want to exact match, use `(?i)^modelname$`"
type:string
startDate:
docs:Apply only to generations which are newer than this ISO date.
type:optional<date>
unit:
docs:Unit used by this model.
type:commons.ModelUsageUnit
inputPrice:
docs:Price (USD) per input unit
type:optional<double>
outputPrice:
docs:Price (USD) per output unit
type:optional<double>
totalPrice:
docs:Price (USD) per total units. Cannot be set if input or output price is set.
type:optional<double>
tokenizerId:
docs:Optional. Tokenizer to be applied to observations which match to this model. See docs for more details.
type:optional<string>
tokenizerConfig:
docs:Optional. Configuration for the selected tokenizer. Needs to be JSON. See docs for more details.
docs:Create a score configuration (config). Score configs are used to define the structure of scores
method:POST
path:/score-configs
request:CreateScoreConfigRequest
response:commons.ScoreConfig
get:
docs:Get all score configs
method:GET
path:/score-configs
request:
name:GetScoreConfigsRequest
query-parameters:
page:
type:optional<integer>
docs:Page number, starts at 1.
limit:
type:optional<integer>
docs:Limit of items per page. If you encounter api issues due to too large page sizes, try to reduce the limit
response:ScoreConfigs
get-by-id:
docs:Get a score config
method:GET
path:/score-configs/{configId}
path-parameters:
configId:
type:string
docs:The unique langfuse identifier of a score config
response:commons.ScoreConfig
types:
ScoreConfigs:
properties:
data:list<commons.ScoreConfig>
meta:pagination.MetaResponse
CreateScoreConfigRequest:
properties:
name:string
dataType:commons.ScoreDataType
categories:
type:optional<list<commons.ConfigCategory>>
docs:Configure custom categories for categorical scores. Pass a list of objects with `label` and `value` properties. Categories are autogenerated for boolean configs and cannot be passed
minValue:
type:optional<double>
docs:Configure a minimum value for numerical scores. If not set, the minimum value defaults to -∞
maxValue:
type:optional<double>
docs:Configure a maximum value for numerical scores. If not set, the maximum value defaults to +∞
description:
type:optional<string>
docs:Description is shown across the Langfuse UI and can be used to e.g. explain the config categories in detail, why a numeric range was set, or provide additional context on config name or usage
docs:Limit of items per page. If you encounter api issues due to too large page sizes, try to reduce the limit.
userId:
type:optional<string>
docs:Retrieve only scores with this userId associated to the trace.
name:
type:optional<string>
docs:Retrieve only scores with this name.
fromTimestamp:
type:optional<datetime>
docs:Retrieve only scores newer than this timestamp.
docs:Optional filter to only include scores created on or after a certain datetime (ISO 8601)
toTimestamp:
type:optional<datetime>
docs:Optional filter to only include scores created before a certain datetime (ISO 8601)
source:
type:optional<commons.ScoreSource>
docs:Retrieve only scores from a specific source.
operator:
type:optional<string>
docs:Retrieve only scores with <operator> value.
value:
type:optional<double>
docs:Retrieve only scores with <operator> value.
scoreIds:
type:optional<string>
docs:Comma-separated list of score IDs to limit the results to.
configId:
type:optional<string>
docs:Retrieve only scores with a specific configId.
dataType:
type:optional<commons.ScoreDataType>
docs:Retrieve only scores with a specific dataType.
response:Scores
get-by-id:
docs:Get a score
@@ -54,9 +79,59 @@ types:
id:optional<string>
traceId:string
name:string
value:double
value:
type:commons.CreateScoreValue
docs:The value of the score. Must be passed as string for categorical scores, and numeric for boolean and numeric scores. Boolean score values must equal either 1 or 0 (true or false)
observationId:optional<string>
comment:optional<string>
dataType:
type:optional<commons.ScoreDataType>
docs:The data type of the score. When passing a configId this field is inferred. Otherwise, this field must be passed or will default to numeric.
configId:
type:optional<string>
docs:Reference a score config on a score. The unique langfuse identifier of a score config. When passing this field, the dataType and stringValue fields are automatically populated.
docs:Limit of items per page. If you encounter api issues due to too large page sizes, try to reduce the limit.
fromTimestamp:
type:optional<datetime>
docs:Optional filter to only include sessions created on or after a certain datetime (ISO 8601)
toTimestamp:
type:optional<datetime>
docs:Optional filter to only include sessions created before a certain datetime (ISO 8601)
response:PaginatedSessions
get:
docs:Get a session
docs:Get a session. Please note that `traces` on this endpoint are not paginated, if you plan to fetch large sessions, consider `GET /api/public/traces?sessionId=<sessionId>`
- A unique constraint covering the columns `[id,project_id]` on the table `scores` will be added. If there are existing duplicate values, this will fail.
- A unique constraint covering the columns `[id,project_id]` on the table `scores` will be added. If there are existing duplicate values, this will fail.
Some files were not shown because too many files have changed in this diff
Show More
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.