Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ba91ed14f1 | ||
|
|
49e8c8c5e0 | ||
|
|
5748cfedd4 | ||
|
|
3f6916b13f | ||
|
|
d7a4a34df1 | ||
|
|
3d3e8967a6 | ||
|
|
f1bf562811 | ||
|
|
02d6c78626 | ||
|
|
251741aacb | ||
|
|
ce49294607 | ||
|
|
a0c876271a | ||
|
|
221d8e9043 | ||
|
|
e5e30eb4cb | ||
|
|
7834a37d32 | ||
|
|
261d857e90 | ||
|
|
25889323e6 | ||
|
|
14f766908b | ||
|
|
6f06a3ab5f | ||
|
|
f706721c12 | ||
|
|
35c8adaccc | ||
|
|
465e1661fa | ||
|
|
1cf917edde | ||
|
|
80efe21420 | ||
|
|
6be2e203ba | ||
|
|
488f5494e0 | ||
|
|
b5eed6653a | ||
|
|
78aa8fdd26 | ||
|
|
9f0fbf8081 | ||
|
|
d63ce00194 | ||
|
|
9ca761bdc6 | ||
|
|
e2ec566fe4 | ||
|
|
bebc76a502 | ||
|
|
7bfbe19a8c | ||
|
|
e625053849 | ||
|
|
dc3530f195 | ||
|
|
1cf7c81386 | ||
|
|
7e31dda960 | ||
|
|
1f64991e7e | ||
|
|
577ad574d1 | ||
|
|
879ef9c8f9 | ||
|
|
a343d5b187 | ||
|
|
ac2b9eaa56 | ||
|
|
43e9cba99a | ||
|
|
601f431f69 | ||
|
|
4fd1f86f9d | ||
|
|
8245888e3c | ||
|
|
daf4e2fe02 | ||
|
|
129693fb69 | ||
|
|
204948db44 | ||
|
|
d42ba5fc99 | ||
|
|
97a539ced3 | ||
|
|
9d8dace197 | ||
|
|
bc2dc4d89c | ||
|
|
2dd5c8a8aa | ||
|
|
d17b21f04d | ||
|
|
c5a0f44bdd | ||
|
|
011b4912f2 | ||
|
|
a4d773066f | ||
|
|
25bdb1690b | ||
|
|
f8565d7772 | ||
|
|
a912057082 | ||
|
|
e0d3270f50 | ||
|
|
99e5a0b224 | ||
|
|
bccdee5410 | ||
|
|
738cbbc8cd | ||
|
|
920c52bb06 | ||
|
|
4f134790af | ||
|
|
21b3ce3c82 | ||
|
|
0531b57e1a | ||
|
|
7b857a0dc4 | ||
|
|
6c97fe3c04 | ||
|
|
1d69cbd41b | ||
|
|
ab26692913 | ||
|
|
b791544864 | ||
|
|
b35583056b | ||
|
|
4504530e3d | ||
|
|
45eed4b5c0 | ||
|
|
9fa31ba68e | ||
|
|
ea35c25269 | ||
|
|
c427791070 | ||
|
|
25220aef55 | ||
|
|
8c02d5dc22 | ||
|
|
0b60076871 | ||
|
|
b28a83531b | ||
|
|
aa4d34ae66 | ||
|
|
cca352ad13 | ||
|
|
58c96cada7 | ||
|
|
6f93389936 | ||
|
|
b8d9586490 | ||
|
|
534f5696ad | ||
|
|
4cebe2831c | ||
|
|
45a5f3b8a2 | ||
|
|
8dea9b6a3a | ||
|
|
c5b781d3f6 | ||
|
|
07469c928d | ||
|
|
5b10110dfe | ||
|
|
0eb5d1c3c0 | ||
|
|
1585bf5e14 | ||
|
|
dec6d6f975 | ||
|
|
36fa7ea15e | ||
|
|
6a4d56a5a9 | ||
|
|
9f0a40949e | ||
|
|
10fdd9e172 | ||
|
|
fc58add111 | ||
|
|
10993838d5 | ||
|
|
148cd29e9f | ||
|
|
7a353e99af | ||
|
|
dc52106feb | ||
|
|
b2f8eb7078 | ||
|
|
026d8e2ba0 |
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"name": "langfuse-development",
|
||||
"forwardPorts": [3000, 5432, 6379, 8123, 9000],
|
||||
"onCreateCommand": "npm install -g pnpm@9.5.0",
|
||||
"postCreateCommand": "curl -L https://github.com/golang-migrate/migrate/releases/download/v4.18.3/migrate.linux-amd64.tar.gz | tar xvz && git restore LICENSE README.md && chmod +x migrate && sudo mv migrate /usr/bin && cp .env.dev.example .env && npm install -g @anthropic-ai/claude-code && pnpm i"
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
# Dev container Dockerfile
|
||||
FROM mcr.microsoft.com/vscode/devcontainers/typescript-node:20-bookworm
|
||||
|
||||
# Install golang-migrate for database migrations
|
||||
RUN curl -L https://github.com/golang-migrate/migrate/releases/download/v4.18.3/migrate.linux-amd64.tar.gz | tar xvz && \
|
||||
chmod +x migrate && \
|
||||
mv migrate /usr/local/bin/migrate
|
||||
|
||||
# Install pnpm globally
|
||||
RUN npm install -g pnpm@9.5.0
|
||||
|
||||
# Install Claude Code CLI
|
||||
RUN npm install -g @anthropic-ai/claude-code
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"name": "langfuse-development",
|
||||
"build": {
|
||||
"dockerfile": "Dockerfile"
|
||||
},
|
||||
"forwardPorts": [3000, 5432, 6379, 8123, 9000],
|
||||
"postCreateCommand": "cp .env.dev.example .env && pnpm i"
|
||||
}
|
||||
@@ -76,6 +76,7 @@ REDIS_AUTH="bitnami"
|
||||
REDIS_CLUSTER_ENABLED="true"
|
||||
REDIS_CLUSTER_NODES="127.0.0.1:6370,127.0.0.1:6371,127.0.0.1:6372,127.0.0.1:6373,127.0.0.1:6374,127.0.0.1:6375"
|
||||
LANGFUSE_INGESTION_QUEUE_SHARD_COUNT=8
|
||||
LANGFUSE_TRACE_UPSERT_QUEUE_SHARD_COUNT=4
|
||||
|
||||
# openssl rand -hex 32 used only here
|
||||
ENCRYPTION_KEY=0000000000000000000000000000000000000000000000000000000000000000
|
||||
@@ -89,4 +90,7 @@ LANGFUSE_EXPERIMENT_COMPARE_READ_FROM_AGGREGATING_MERGE_TREES="true"
|
||||
LANGFUSE_EXPERIMENT_WHITELISTED_PROJECT_IDS="7a88fb47-b4e2-43b8-a06c-a5ce950dc53a"
|
||||
LANGFUSE_EXPERIMENT_ADD_QUERY_RESULT_TO_SPAN_PROJECT_IDS="7a88fb47-b4e2-43b8-a06c-a5ce950dc53a"
|
||||
LANGFUSE_EXPERIMENT_RETURN_NEW_RESULT="true"
|
||||
LANGFUSE_EXPERIMENT_SAMPLING_RATE=1
|
||||
LANGFUSE_EXPERIMENT_SAMPLING_RATE=1
|
||||
|
||||
# LANGFUSE_EXPERIMENT_DATASET_RUN_ITEMS_WRITE_CH=true
|
||||
# LANGFUSE_EXPERIMENT_DATASET_RUN_ITEMS_READ_CH=true
|
||||
|
||||
@@ -1,33 +1,45 @@
|
||||
name: 🐞 Bug Report
|
||||
description: Create a bug report to help us improve
|
||||
title: "bug: "
|
||||
description: Report a bug to help us improve
|
||||
title: "bug: <short description>"
|
||||
labels: ["🐞❔ unconfirmed bug"]
|
||||
body:
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Describe the bug
|
||||
description: A clear and concise description of the bug, as well as what you expected to happen when encountering it.
|
||||
description: A clear and concise description of the bug, and what you expected to happen when you encountered it.
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: To reproduce
|
||||
description: Describe how to reproduce your bug. Please provide detailed steps, code snippets, reproduction repos etc.
|
||||
label: Steps to reproduce
|
||||
description: Describe how to reproduce the bug. Please provide detailed steps, code snippets, a minimal reproduction repository, etc.
|
||||
validations:
|
||||
required: true
|
||||
- type: dropdown
|
||||
attributes:
|
||||
label: Langfuse Cloud or self-hosted?
|
||||
options:
|
||||
- "Langfuse Cloud"
|
||||
- "Self-hosted"
|
||||
validations:
|
||||
required: true
|
||||
- type: input
|
||||
attributes:
|
||||
label: If self-hosted, what version are you running?
|
||||
description: We may ask you to upgrade to the latest version, as many issues are continuously being fixed.
|
||||
- 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.
|
||||
label: SDK and integration versions
|
||||
description: If you're experiencing an issue with an integration or SDK, please share all package versions you're using. If you are not on the latest version, try upgrading, as this will often resolve the issue.
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Additional information
|
||||
description: Add any other information related to the bug here, screenshots if applicable.
|
||||
description: Add any other information related to the bug here, including 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.
|
||||
label: Are you interested in contributing a fix for this bug?
|
||||
description: If this is a confirmed bug, the maintainers are happy to provide guidance and review.
|
||||
options:
|
||||
- "No"
|
||||
- "Yes"
|
||||
|
||||
@@ -57,8 +57,6 @@ yarn-error.log*
|
||||
|
||||
|
||||
# vscode
|
||||
.devcontainer
|
||||
|
||||
node_modules
|
||||
**/node_modules
|
||||
**/dist
|
||||
|
||||
@@ -83,7 +83,8 @@ Depending on the file location (sync, async)
|
||||
`web` related tests must go into the `web/src/__tests__/` folder.
|
||||
```sh
|
||||
pnpm test-sync --testPathPattern="$FILE_LOCATION_PATTERN" --testNamePattern="$TEST_NAME_PATTERN"
|
||||
pnpm test-async --testPathPattern="$FILE_LOCATION_PATTERN" --testNamePattern="$TEST_NAME_PATTERN"
|
||||
# For tests in the async folder:
|
||||
pnpm test -- --testPathPattern="$FILE_LOCATION_PATTERN" --testNamePattern="$TEST_NAME_PATTERN"
|
||||
```
|
||||
|
||||
### Testing in the Worker Package
|
||||
|
||||
+3
-1
@@ -241,7 +241,7 @@ We're using Jest with in the `web` package. Therefore, if you want to provide an
|
||||
There are three types of unit tests:
|
||||
|
||||
- `test-sync`
|
||||
- `test-async`
|
||||
- `test` (for async folder tests)
|
||||
- `test-client`
|
||||
|
||||
To run a specific test, for example the test: `"should handle special characters in prompt names"` in `prompts.v2.servertest.ts`, run:
|
||||
@@ -249,6 +249,8 @@ To run a specific test, for example the test: `"should handle special characters
|
||||
```sh
|
||||
cd web # or with --filter=web
|
||||
pnpm test-sync --testPathPattern="prompts\.v2\.servertest" --testNamePattern="should handle special characters in prompt names"
|
||||
# for async folder tests:
|
||||
pnpm test -- --testPathPattern="observations-api" --testNamePattern="should fetch all observations"
|
||||
```
|
||||
|
||||
To run all tests:
|
||||
|
||||
+88
-86
@@ -91,12 +91,11 @@ Langfuse 是一个 **开源 LLM 工程** 平台。它帮助团队协作 **开发
|
||||

|
||||
|
||||
- [LLM 应用可观察性](https://langfuse.com/docs/tracing):为你的应用插入仪表代码,并开始将追踪数据传送到 Langfuse,从而追踪 LLM 调用及应用中其他相关逻辑(如检索、嵌入或代理操作)。检查并调试复杂日志及用户会话。试试互动的 [演示](https://langfuse.com/docs/demo) 看看效果。
|
||||
|
||||
- [提示管理](https://langfuse.com/docs/prompts/get-started) 帮助你集中管理、版本控制并协作迭代提示。得益于服务器和客户端的高效缓存,你可以在不增加延迟的情况下反复迭代提示。
|
||||
- [提示管理](https://langfuse.com/docs/prompt-management/get-started) 帮助你集中管理、版本控制并协作迭代提示。得益于服务器和客户端的高效缓存,你可以在不增加延迟的情况下反复迭代提示。
|
||||
|
||||
- [评估](https://langfuse.com/docs/scores/overview) 是 LLM 应用开发流程的关键组成部分,Langfuse 能够满足你的多样需求。它支持 LLM 作为"裁判"、用户反馈收集、手动标注以及通过 API/SDK 实现自定义评估流程。
|
||||
- [评估](https://langfuse.com/docs/evaluation/overview) 是 LLM 应用开发流程的关键组成部分,Langfuse 能够满足你的多样需求。它支持 LLM 作为"裁判"、用户反馈收集、手动标注以及通过 API/SDK 实现自定义评估流程。
|
||||
|
||||
- [数据集](https://langfuse.com/docs/datasets/overview) 为评估你的 LLM 应用提供测试集和基准。它们支持持续改进、部署前测试、结构化实验、灵活评估,并能与 LangChain、LlamaIndex 等框架无缝整合。
|
||||
- [数据集](https://langfuse.com/docs/evaluation/dataset-runs/datasets) 为评估你的 LLM 应用提供测试集和基准。它们支持持续改进、部署前测试、结构化实验、灵活评估,并能与 LangChain、LlamaIndex 等框架无缝整合。
|
||||
|
||||
- [LLM 试玩平台](https://langfuse.com/docs/playground) 是用于测试和迭代提示及模型配置的工具,缩短反馈周期,加速开发。当你在追踪中发现异常结果时,可以直接跳转至试玩平台进行调整。
|
||||
|
||||
@@ -122,14 +121,14 @@ Langfuse 是一个 **开源 LLM 工程** 平台。它帮助团队协作 **开发
|
||||
|
||||
- [本地(docker compose)](https://langfuse.com/self-hosting/local):使用 Docker Compose 在你的机器上于 5 分钟内运行 Langfuse。
|
||||
|
||||
````bash:README.md/docker-compose
|
||||
```bash:README.md/docker-compose
|
||||
# 获取最新的 Langfuse 仓库副本
|
||||
git clone https://github.com/langfuse/langfuse.git
|
||||
cd langfuse
|
||||
|
||||
# 运行 Langfuse 的 docker compose
|
||||
docker compose up
|
||||
`````
|
||||
```
|
||||
|
||||
- [Kubernetes(Helm)](https://langfuse.com/self-hosting/kubernetes-helm):使用 Helm 在 Kubernetes 集群上部署 Langfuse。这是推荐的生产环境部署方式。
|
||||
|
||||
@@ -145,40 +144,40 @@ Langfuse 是一个 **开源 LLM 工程** 平台。它帮助团队协作 **开发
|
||||
|
||||
### 主要集成:
|
||||
|
||||
| 集成 | 支持语言/平台 | 描述 |
|
||||
| ---------------------------------------------------------------------- | ------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| [SDK](https://langfuse.com/docs/sdk) | Python, JS/TS | 使用 SDK 进行手动仪表化,实现全面灵活性。 |
|
||||
| [OpenAI](https://langfuse.com/docs/integrations/openai) | Python, JS/TS | 通过直接替换 OpenAI SDK 实现自动仪表化。 |
|
||||
| [Langchain](https://langfuse.com/docs/integrations/langchain) | Python, JS/TS | 通过传入回调处理器至 Langchain 应用实现自动仪表化。 |
|
||||
| [LlamaIndex](https://langfuse.com/docs/integrations/llama-index/get-started) | Python | 通过 LlamaIndex 回调系统实现自动仪表化。 |
|
||||
| [Haystack](https://langfuse.com/docs/integrations/haystack) | Python | 通过 Haystack 内容追踪系统实现自动仪表化。 |
|
||||
| [LiteLLM](https://langfuse.com/docs/integrations/litellm) | Python, JS/TS (仅代理) | 允许使用任何 LLM 替代 GPT。支持 Azure、OpenAI、Cohere、Anthropic、Ollama、VLLM、Sagemaker、HuggingFace、Replicate(100+ LLMs)。 |
|
||||
| [Vercel AI SDK](https://langfuse.com/docs/integrations/vercel-ai-sdk) | JS/TS | 基于 TypeScript 的工具包,帮助开发者使用 React、Next.js、Vue、Svelte 和 Node.js 构建 AI 驱动的应用。 |
|
||||
| [API](https://langfuse.com/docs/api) | | 直接调用公共 API。提供 OpenAPI 规格。 |
|
||||
| [Google VertexAI 和 Gemini](https://langfuse.com/docs/integrations/google-vertex-ai) | 模型 | 在 Google 上运行基础模型和微调模型。 |
|
||||
| 集成 | 支持语言/平台 | 描述 |
|
||||
| ------------------------------------------------------------------------------------ | ---------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| [SDK](https://langfuse.com/docs/sdk) | Python, JS/TS | 使用 SDK 进行手动仪表化,实现全面灵活性。 |
|
||||
| [OpenAI](https://langfuse.com/integrations/model-providers/openai-py) | Python, JS/TS | 通过直接替换 OpenAI SDK 实现自动仪表化。 |
|
||||
| [Langchain](https://langfuse.com/docs/integrations/langchain) | Python, JS/TS | 通过传入回调处理器至 Langchain 应用实现自动仪表化。 |
|
||||
| [LlamaIndex](https://langfuse.com/docs/integrations/llama-index/get-started) | Python | 通过 LlamaIndex 回调系统实现自动仪表化。 |
|
||||
| [Haystack](https://langfuse.com/docs/integrations/haystack) | Python | 通过 Haystack 内容追踪系统实现自动仪表化。 |
|
||||
| [LiteLLM](https://langfuse.com/docs/integrations/litellm) | Python, JS/TS (仅代理) | 允许使用任何 LLM 替代 GPT。支持 Azure、OpenAI、Cohere、Anthropic、Ollama、VLLM、Sagemaker、HuggingFace、Replicate(100+ LLMs)。 |
|
||||
| [Vercel AI SDK](https://langfuse.com/docs/integrations/vercel-ai-sdk) | JS/TS | 基于 TypeScript 的工具包,帮助开发者使用 React、Next.js、Vue、Svelte 和 Node.js 构建 AI 驱动的应用。 |
|
||||
| [API](https://langfuse.com/docs/api) | | 直接调用公共 API。提供 OpenAPI 规格。 |
|
||||
| [Google VertexAI 和 Gemini](https://langfuse.com/docs/integrations/google-vertex-ai) | 模型 | 在 Google 上运行基础模型和微调模型。 |
|
||||
|
||||
### 与 Langfuse 集成的软件包:
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| ---------------------------------------------------------------------- | ------------------- | -------------------------------------------------------------------------------------------------------- |
|
||||
| [Instructor](https://langfuse.com/docs/integrations/instructor) | 库 | 用于获取结构化 LLM 输出(JSON、Pydantic)的库。 |
|
||||
| [DSPy](https://langfuse.com/docs/integrations/dspy) | 库 | 一个系统性优化语言模型提示和权重的框架。 |
|
||||
| [Amazon Bedrock](https://langfuse.com/docs/integrations/amazon-bedrock) | 模型 | 在 AWS 上运行基础模型和微调模型。 |
|
||||
| [Mirascope](https://langfuse.com/docs/integrations/mirascope) | 库 | 构建 LLM 应用的 Python 工具包。 |
|
||||
| [Ollama](https://langfuse.com/docs/integrations/ollama) | 模型(本地) | 在你的机器上轻松运行开源 LLM。 |
|
||||
| [AutoGen](https://langfuse.com/docs/integrations/autogen) | 代理框架 | 用于构建分布式代理的开源 LLM 平台。 |
|
||||
| [Flowise](https://langfuse.com/docs/integrations/flowise) | 聊天/代理界面 | 基于 JS/TS 的无代码构建器,用于定制化 LLM 流程。 |
|
||||
| [Langflow](https://langfuse.com/docs/integrations/langflow) | 聊天/代理界面 | 基于 Python 的 LangChain 用户界面,采用 react-flow 设计,提供便捷的实验与原型构建体验。 |
|
||||
| [Dify](https://langfuse.com/docs/integrations/dify) | 聊天/代理界面 | 带有无代码构建器的开源 LLM 应用开发平台。 |
|
||||
| [OpenWebUI](https://langfuse.com/docs/integrations/openwebui) | 聊天/代理界面 | 自托管的 LLM 聊天网页界面,支持包括自托管和本地模型在内的多种 LLM 运行器。 |
|
||||
| [Promptfoo](https://langfuse.com/docs/integrations/promptfoo) | 工具 | 开源 LLM 测试平台。 |
|
||||
| [LobeChat](https://langfuse.com/docs/integrations/lobechat) | 聊天/代理界面 | 开源聊天机器人平台。 |
|
||||
| [Vapi](https://langfuse.com/docs/integrations/vapi) | 平台 | 开源语音 AI 平台。 |
|
||||
| [Inferable](https://langfuse.com/docs/integrations/other/inferable) | 代理 | 构建分布式代理的开源 LLM 平台。 |
|
||||
| [Gradio](https://langfuse.com/docs/integrations/other/gradio) | 聊天/代理界面 | 开源 Python 库,可用于构建类似聊天 UI 的网页界面。 |
|
||||
| [Goose](https://langfuse.com/docs/integrations/goose) | 代理 | 构建分布式代理的开源 LLM 平台。 |
|
||||
| [smolagents](https://langfuse.com/docs/integrations/smolagents) | 代理 | 开源 AI 代理框架。 |
|
||||
| [CrewAI](https://langfuse.com/docs/integrations/crewai) | 代理 | 多代理框架,用于实现代理之间的协作与工具调用。 |
|
||||
| 名称 | 类型 | 描述 |
|
||||
| ----------------------------------------------------------------------- | ------------- | --------------------------------------------------------------------------------------- |
|
||||
| [Instructor](https://langfuse.com/docs/integrations/instructor) | 库 | 用于获取结构化 LLM 输出(JSON、Pydantic)的库。 |
|
||||
| [DSPy](https://langfuse.com/docs/integrations/dspy) | 库 | 一个系统性优化语言模型提示和权重的框架。 |
|
||||
| [Amazon Bedrock](https://langfuse.com/docs/integrations/amazon-bedrock) | 模型 | 在 AWS 上运行基础模型和微调模型。 |
|
||||
| [Mirascope](https://langfuse.com/docs/integrations/mirascope) | 库 | 构建 LLM 应用的 Python 工具包。 |
|
||||
| [Ollama](https://langfuse.com/docs/integrations/ollama) | 模型(本地) | 在你的机器上轻松运行开源 LLM。 |
|
||||
| [AutoGen](https://langfuse.com/docs/integrations/autogen) | 代理框架 | 用于构建分布式代理的开源 LLM 平台。 |
|
||||
| [Flowise](https://langfuse.com/docs/integrations/flowise) | 聊天/代理界面 | 基于 JS/TS 的无代码构建器,用于定制化 LLM 流程。 |
|
||||
| [Langflow](https://langfuse.com/docs/integrations/langflow) | 聊天/代理界面 | 基于 Python 的 LangChain 用户界面,采用 react-flow 设计,提供便捷的实验与原型构建体验。 |
|
||||
| [Dify](https://langfuse.com/docs/integrations/dify) | 聊天/代理界面 | 带有无代码构建器的开源 LLM 应用开发平台。 |
|
||||
| [OpenWebUI](https://langfuse.com/docs/integrations/openwebui) | 聊天/代理界面 | 自托管的 LLM 聊天网页界面,支持包括自托管和本地模型在内的多种 LLM 运行器。 |
|
||||
| [Promptfoo](https://langfuse.com/docs/integrations/promptfoo) | 工具 | 开源 LLM 测试平台。 |
|
||||
| [LobeChat](https://langfuse.com/docs/integrations/lobechat) | 聊天/代理界面 | 开源聊天机器人平台。 |
|
||||
| [Vapi](https://langfuse.com/docs/integrations/vapi) | 平台 | 开源语音 AI 平台。 |
|
||||
| [Inferable](https://langfuse.com/docs/integrations/other/inferable) | 代理 | 构建分布式代理的开源 LLM 平台。 |
|
||||
| [Gradio](https://langfuse.com/docs/integrations/other/gradio) | 聊天/代理界面 | 开源 Python 库,可用于构建类似聊天 UI 的网页界面。 |
|
||||
| [Goose](https://langfuse.com/docs/integrations/goose) | 代理 | 构建分布式代理的开源 LLM 平台。 |
|
||||
| [smolagents](https://langfuse.com/docs/integrations/smolagents) | 代理 | 开源 AI 代理框架。 |
|
||||
| [CrewAI](https://langfuse.com/docs/integrations/crewai) | 代理 | 多代理框架,用于实现代理之间的协作与工具调用。 |
|
||||
|
||||
## 🚀 快速入门
|
||||
|
||||
@@ -192,25 +191,25 @@ Langfuse 是一个 **开源 LLM 工程** 平台。它帮助团队协作 **开发
|
||||
|
||||
### 2️⃣ 记录你的第一个 LLM 调用
|
||||
|
||||
使用 [<code>@observe()</code> 装饰器](https://langfuse.com/docs/sdk/python/decorators) 可轻松跟踪任何 Python LLM 应用。在本快速入门中,我们还使用了 Langfuse 的 [OpenAI 集成](https://langfuse.com/docs/integrations/openai) 来自动捕获所有模型参数。
|
||||
使用 [<code>@observe()</code> 装饰器](https://langfuse.com/docs/sdk/python/decorators) 可轻松跟踪任何 Python LLM 应用。在本快速入门中,我们还使用了 Langfuse 的 [OpenAI 集成](https://langfuse.com/integrations/model-providers/openai-py) 来自动捕获所有模型参数。
|
||||
|
||||
> [!提示]
|
||||
> 不使用 OpenAI?请访问 [我们的文档](https://langfuse.com/docs/get-started#log-your-first-llm-call-to-langfuse) 了解如何记录其他模型和框架。
|
||||
|
||||
安装依赖:
|
||||
|
||||
````bash
|
||||
```bash
|
||||
pip install langfuse openai
|
||||
````
|
||||
```
|
||||
|
||||
配置环境变量(创建名为 **.env** 的文件):
|
||||
|
||||
````bash:.env
|
||||
```bash:.env
|
||||
LANGFUSE_SECRET_KEY="sk-lf-..."
|
||||
LANGFUSE_PUBLIC_KEY="pk-lf-..."
|
||||
LANGFUSE_HOST="https://cloud.langfuse.com" # 🇪🇺 欧盟区域
|
||||
# LANGFUSE_HOST="https://us.cloud.langfuse.com" # 🇺🇸 美洲区域
|
||||
````
|
||||
```
|
||||
|
||||
创建示例代码(文件名:**main.py**):
|
||||
|
||||
@@ -230,7 +229,7 @@ def main():
|
||||
return story()
|
||||
|
||||
main()
|
||||
````
|
||||
```
|
||||
|
||||
### 3️⃣ 在 Langfuse 中查看追踪记录
|
||||
|
||||
@@ -289,51 +288,51 @@ _[Langfuse 中的公共示例追踪](https://cloud.langfuse.com/project/cloramnk
|
||||
|
||||
以下是使用 Langfuse 的顶级开源 Python 项目,按星标数排名([来源](https://github.com/langfuse/langfuse-docs/blob/main/components-mdx/dependents)):
|
||||
|
||||
| 仓库 | 星数 |
|
||||
| :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----: |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/127165244?s=40&v=4" width="20" height="20" alt=""> [langgenius](https://github.com/langgenius) / [dify](https://github.com/langgenius/dify) | 54865 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/158137808?s=40&v=4" width="20" height="20" alt=""> [open-webui](https://github.com/open-webui) / [open-webui](https://github.com/open-webui/open-webui) | 51531 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/131470832?s=40&v=4" width="20" height="20" alt=""> [lobehub](https://github.com/lobehub) / [lobe-chat](https://github.com/lobehub/lobe-chat) | 49003 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/85702467?s=40&v=4" width="20" height="20" alt=""> [langflow-ai](https://github.com/langflow-ai) / [langflow](https://github.com/langflow-ai/langflow) | 39093 |
|
||||
| 仓库 | 星数 |
|
||||
| :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----: |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/127165244?s=40&v=4" width="20" height="20" alt=""> [langgenius](https://github.com/langgenius) / [dify](https://github.com/langgenius/dify) | 54865 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/158137808?s=40&v=4" width="20" height="20" alt=""> [open-webui](https://github.com/open-webui) / [open-webui](https://github.com/open-webui/open-webui) | 51531 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/131470832?s=40&v=4" width="20" height="20" alt=""> [lobehub](https://github.com/lobehub) / [lobe-chat](https://github.com/lobehub/lobe-chat) | 49003 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/85702467?s=40&v=4" width="20" height="20" alt=""> [langflow-ai](https://github.com/langflow-ai) / [langflow](https://github.com/langflow-ai/langflow) | 39093 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/130722866?s=40&v=4" width="20" height="20" alt=""> [run-llama](https://github.com/run-llama) / [llama_index](https://github.com/run-llama/llama_index) | 37368 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/139558948?s=40&v=4" width="20" height="20" alt=""> [chatchat-space](https://github.com/chatchat-space) / [Langchain-Chatchat](https://github.com/chatchat-space/Langchain-Chatchat) | 32486 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/128289781?s=40&v=4" width="20" height="20" alt=""> [FlowiseAI](https://github.com/FlowiseAI) / [Flowise](https://github.com/FlowiseAI/Flowise) | 32448 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/31035808?s=40&v=4" width="20" height="20" alt=""> [mindsdb](https://github.com/mindsdb) / [mindsdb](https://github.com/mindsdb/mindsdb) | 26931 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/119600397?s=40&v=4" width="20" height="20" alt=""> [twentyhq](https://github.com/twentyhq) / [twenty](https://github.com/twentyhq/twenty) | 24195 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/60330232?s=40&v=4" width="20" height="20" alt=""> [PostHog](https://github.com/PostHog) / [posthog](https://github.com/PostHog/posthog) | 22618 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/121462774?s=40&v=4" width="20" height="20" alt=""> [BerriAI](https://github.com/BerriAI) / [litellm](https://github.com/BerriAI/litellm) | 15151 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/179202840?s=40&v=4" width="20" height="20" alt=""> [mediar-ai](https://github.com/mediar-ai) / [screenpipe](https://github.com/mediar-ai/screenpipe) | 11037 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/105877416?s=40&v=4" width="20" height="20" alt=""> [formbricks](https://github.com/formbricks) / [formbricks](https://github.com/formbricks/formbricks) | 9386 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/76263028?s=40&v=4" width="20" height="20" alt=""> [anthropics](https://github.com/anthropics) / [courses](https://github.com/anthropics/courses) | 8385 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/78410652?s=40&v=4" width="20" height="20" alt=""> [GreyDGL](https://github.com/GreyDGL) / [PentestGPT](https://github.com/GreyDGL/PentestGPT) | 7374 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/152537519?s=40&v=4" width="20" height="20" alt=""> [superagent-ai](https://github.com/superagent-ai) / [superagent](https://github.com/superagent-ai/superagent) | 5391 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/137907881?s=40&v=4" width="20" height="20" alt=""> [promptfoo](https://github.com/promptfoo) / [promptfoo](https://github.com/promptfoo/promptfoo) | 4976 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/157326433?s=40&v=4" width="20" height="20" alt=""> [onlook-dev](https://github.com/onlook-dev) / [onlook](https://github.com/onlook-dev/onlook) | 4141 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/7250217?s=40&v=4" width="20" height="20" alt=""> [Canner](https://github.com/Canner) / [WrenAI](https://github.com/Canner/WrenAI) | 2526 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/11855343?s=40&v=4" width="20" height="20" alt=""> [pingcap](https://github.com/pingcap) / [autoflow](https://github.com/pingcap/autoflow) | 2061 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/85268109?s=40&v=4" width="20" height="20" alt=""> [MLSysOps](https://github.com/MLSysOps) / [MLE-agent](https://github.com/MLSysOps/MLE-agent) | 1161 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/158137808?s=40&v=4" width="20" height="20" alt=""> [open-webui](https://github.com/open-webui) / [pipelines](https://github.com/open-webui/pipelines) | 1100 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/18422723?s=40&v=4" width="20" height="20" alt=""> [alishobeiri](https://github.com/alishobeiri) / [thread](https://github.com/alishobeiri/thread) | 1074 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/125468716?s=40&v=4" width="20" height="20" alt=""> [topoteretes](https://github.com/topoteretes) / [cognee](https://github.com/topoteretes/cognee) | 971 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/188657705?s=40&v=4" width="20" height="20" alt=""> [bRAGAI](https://github.com/bRAGAI) / [bRAG-langchain](https://github.com/bRAGAI/bRAG-langchain) | 823 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/169500408?s=40&v=4" width="20" height="20" alt=""> [opslane](https://github.com/opslane) / [opslane](https://github.com/opslane/opslane) | 677 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/151867818?s=40&v=4" width="20" height="20" alt=""> [dynamiq-ai](https://github.com/dynamiq-ai) / [dynamiq](https://github.com/dynamiq-ai/dynamiq) | 639 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/48585267?s=40&v=4" width="20" height="20" alt=""> [theopenconversationkit](https://github.com/theopenconversationkit) / [tock](https://github.com/theopenconversationkit/tock) | 514 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/20493493?s=40&v=4" width="20" height="20" alt=""> [andysingal](https://github.com/andysingal) / [llm-course](https://github.com/andysingal/llm-course) | 394 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/132396805?s=40&v=4" width="20" height="20" alt=""> [phospho-app](https://github.com/phospho-app) / [phospho](https://github.com/phospho-app/phospho) | 384 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/178644984?s=40&v=4" width="20" height="20" alt=""> [sentient-engineering](https://github.com/sentient-engineering) / [agent-q](https://github.com/sentient-engineering/agent-q) | 370 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/168552753?s=40&v=4" width="20" height="20" alt=""> [sql-agi](https://github.com/sql-agi) / [DB-GPT](https://github.com/sql-agi/DB-GPT) | 324 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/60330232?s=40&v=4" width="20" height="20" alt=""> [PostHog](https://github.com/PostHog) / [posthog-foss](https://github.com/PostHog/posthog-foss) | 305 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/154247157?s=40&v=4" width="20" height="20" alt=""> [vespperhq](https://github.com/vespperhq) / [vespper](https://github.com/vespperhq/vespper) | 304 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/185116535?s=40&v=4" width="20" height="20" alt=""> [block](https://github.com/block) / [goose](https://github.com/block/goose) | 295 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/609489?s=40&v=4" width="20" height="20" alt=""> [aorwall](https://github.com/aorwall) / [moatless-tools](https://github.com/aorwall/moatless-tools) | 291 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/2357342?s=40&v=4" width="20" height="20" alt=""> [dmayboroda](https://github.com/dmayboroda) / [minima](https://github.com/dmayboroda/minima) | 221 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/66303003?s=40&v=4" width="20" height="20" alt=""> [RobotecAI](https://github.com/RobotecAI) / [rai](https://github.com/RobotecAI/rai) | 172 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/148684274?s=40&v=4" width="20" height="20" alt=""> [i-am-alice](https://github.com/i-am-alice) / [3rd-devs](https://github.com/i-am-alice/3rd-devs) | 148 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/171735272?s=40&v=4" width="20" height="20" alt=""> [8090-inc](https://github.com/8090-inc) / [xrx-sample-apps](https://github.com/8090-inc/xrx-sample-apps) | 138 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/104478511?s=40&v=4" width="20" height="20" alt=""> [babelcloud](https://github.com/babelcloud) / [LLM-RGB](https://github.com/babelcloud/LLM-RGB) | 135 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/15125613?s=40&v=4" width="20" height="20" alt=""> [souzatharsis](https://github.com/souzatharsis) / [tamingLLMs](https://github.com/souzatharsis/tamingLLMs) | 129 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/169401942?s=40&v=4" width="20" height="20" alt=""> [LibreChat-AI](https://github.com/LibreChat-AI) / [librechat.ai](https://github.com/LibreChat-AI/librechat.ai) | 128 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/128289781?s=40&v=4" width="20" height="20" alt=""> [FlowiseAI](https://github.com/FlowiseAI) / [Flowise](https://github.com/FlowiseAI/Flowise) | 32448 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/31035808?s=40&v=4" width="20" height="20" alt=""> [mindsdb](https://github.com/mindsdb) / [mindsdb](https://github.com/mindsdb/mindsdb) | 26931 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/119600397?s=40&v=4" width="20" height="20" alt=""> [twentyhq](https://github.com/twentyhq) / [twenty](https://github.com/twentyhq/twenty) | 24195 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/60330232?s=40&v=4" width="20" height="20" alt=""> [PostHog](https://github.com/PostHog) / [posthog](https://github.com/PostHog/posthog) | 22618 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/121462774?s=40&v=4" width="20" height="20" alt=""> [BerriAI](https://github.com/BerriAI) / [litellm](https://github.com/BerriAI/litellm) | 15151 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/179202840?s=40&v=4" width="20" height="20" alt=""> [mediar-ai](https://github.com/mediar-ai) / [screenpipe](https://github.com/mediar-ai/screenpipe) | 11037 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/105877416?s=40&v=4" width="20" height="20" alt=""> [formbricks](https://github.com/formbricks) / [formbricks](https://github.com/formbricks/formbricks) | 9386 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/76263028?s=40&v=4" width="20" height="20" alt=""> [anthropics](https://github.com/anthropics) / [courses](https://github.com/anthropics/courses) | 8385 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/78410652?s=40&v=4" width="20" height="20" alt=""> [GreyDGL](https://github.com/GreyDGL) / [PentestGPT](https://github.com/GreyDGL/PentestGPT) | 7374 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/152537519?s=40&v=4" width="20" height="20" alt=""> [superagent-ai](https://github.com/superagent-ai) / [superagent](https://github.com/superagent-ai/superagent) | 5391 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/137907881?s=40&v=4" width="20" height="20" alt=""> [promptfoo](https://github.com/promptfoo) / [promptfoo](https://github.com/promptfoo/promptfoo) | 4976 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/157326433?s=40&v=4" width="20" height="20" alt=""> [onlook-dev](https://github.com/onlook-dev) / [onlook](https://github.com/onlook-dev/onlook) | 4141 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/7250217?s=40&v=4" width="20" height="20" alt=""> [Canner](https://github.com/Canner) / [WrenAI](https://github.com/Canner/WrenAI) | 2526 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/11855343?s=40&v=4" width="20" height="20" alt=""> [pingcap](https://github.com/pingcap) / [autoflow](https://github.com/pingcap/autoflow) | 2061 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/85268109?s=40&v=4" width="20" height="20" alt=""> [MLSysOps](https://github.com/MLSysOps) / [MLE-agent](https://github.com/MLSysOps/MLE-agent) | 1161 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/158137808?s=40&v=4" width="20" height="20" alt=""> [open-webui](https://github.com/open-webui) / [pipelines](https://github.com/open-webui/pipelines) | 1100 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/18422723?s=40&v=4" width="20" height="20" alt=""> [alishobeiri](https://github.com/alishobeiri) / [thread](https://github.com/alishobeiri/thread) | 1074 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/125468716?s=40&v=4" width="20" height="20" alt=""> [topoteretes](https://github.com/topoteretes) / [cognee](https://github.com/topoteretes/cognee) | 971 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/188657705?s=40&v=4" width="20" height="20" alt=""> [bRAGAI](https://github.com/bRAGAI) / [bRAG-langchain](https://github.com/bRAGAI/bRAG-langchain) | 823 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/169500408?s=40&v=4" width="20" height="20" alt=""> [opslane](https://github.com/opslane) / [opslane](https://github.com/opslane/opslane) | 677 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/151867818?s=40&v=4" width="20" height="20" alt=""> [dynamiq-ai](https://github.com/dynamiq-ai) / [dynamiq](https://github.com/dynamiq-ai/dynamiq) | 639 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/48585267?s=40&v=4" width="20" height="20" alt=""> [theopenconversationkit](https://github.com/theopenconversationkit) / [tock](https://github.com/theopenconversationkit/tock) | 514 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/20493493?s=40&v=4" width="20" height="20" alt=""> [andysingal](https://github.com/andysingal) / [llm-course](https://github.com/andysingal/llm-course) | 394 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/132396805?s=40&v=4" width="20" height="20" alt=""> [phospho-app](https://github.com/phospho-app) / [phospho](https://github.com/phospho-app/phospho) | 384 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/178644984?s=40&v=4" width="20" height="20" alt=""> [sentient-engineering](https://github.com/sentient-engineering) / [agent-q](https://github.com/sentient-engineering/agent-q) | 370 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/168552753?s=40&v=4" width="20" height="20" alt=""> [sql-agi](https://github.com/sql-agi) / [DB-GPT](https://github.com/sql-agi/DB-GPT) | 324 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/60330232?s=40&v=4" width="20" height="20" alt=""> [PostHog](https://github.com/PostHog) / [posthog-foss](https://github.com/PostHog/posthog-foss) | 305 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/154247157?s=40&v=4" width="20" height="20" alt=""> [vespperhq](https://github.com/vespperhq) / [vespper](https://github.com/vespperhq/vespper) | 304 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/185116535?s=40&v=4" width="20" height="20" alt=""> [block](https://github.com/block) / [goose](https://github.com/block/goose) | 295 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/609489?s=40&v=4" width="20" height="20" alt=""> [aorwall](https://github.com/aorwall) / [moatless-tools](https://github.com/aorwall/moatless-tools) | 291 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/2357342?s=40&v=4" width="20" height="20" alt=""> [dmayboroda](https://github.com/dmayboroda) / [minima](https://github.com/dmayboroda/minima) | 221 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/66303003?s=40&v=4" width="20" height="20" alt=""> [RobotecAI](https://github.com/RobotecAI) / [rai](https://github.com/RobotecAI/rai) | 172 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/148684274?s=40&v=4" width="20" height="20" alt=""> [i-am-alice](https://github.com/i-am-alice) / [3rd-devs](https://github.com/i-am-alice/3rd-devs) | 148 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/171735272?s=40&v=4" width="20" height="20" alt=""> [8090-inc](https://github.com/8090-inc) / [xrx-sample-apps](https://github.com/8090-inc/xrx-sample-apps) | 138 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/104478511?s=40&v=4" width="20" height="20" alt=""> [babelcloud](https://github.com/babelcloud) / [LLM-RGB](https://github.com/babelcloud/LLM-RGB) | 135 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/15125613?s=40&v=4" width="20" height="20" alt=""> [souzatharsis](https://github.com/souzatharsis) / [tamingLLMs](https://github.com/souzatharsis/tamingLLMs) | 129 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/169401942?s=40&v=4" width="20" height="20" alt=""> [LibreChat-AI](https://github.com/LibreChat-AI) / [librechat.ai](https://github.com/LibreChat-AI/librechat.ai) | 128 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/51827949?s=40&v=4" width="20" height="20" alt=""> [deepset-ai](https://github.com/deepset-ai) / [haystack-core-integrations](https://github.com/deepset-ai/haystack-core-integrations) | 126 |
|
||||
|
||||
## 🔒 安全与隐私
|
||||
@@ -352,4 +351,7 @@ _[Langfuse 中的公共示例追踪](https://cloud.langfuse.com/project/cloramnk
|
||||
所有数据均不会与第三方共享,也不包含任何敏感信息。我们对这一过程保持高度透明,你可以在 [此处](/web/src/features/telemetry/index.ts) 查看我们收集的具体数据。
|
||||
|
||||
你可以通过设置 `TELEMETRY_ENABLED=false` 来选择退出。
|
||||
|
||||
```
|
||||
|
||||
```
|
||||
|
||||
+80
-80
@@ -84,15 +84,15 @@ Langfuseは**数分でセルフホスト可能**で、**多くの実績を持つ
|
||||
複雑なログやユーザーセッションを解析・デバッグできます。
|
||||
インタラクティブな[デモ](https://langfuse.com/docs/demo)で動作を確認してください。
|
||||
|
||||
- **[プロンプト管理](https://langfuse.com/docs/prompts/get-started):**
|
||||
- **[プロンプト管理](https://langfuse.com/docs/prompt-management/get-started):**
|
||||
プロンプトを一元管理し、バージョン管理しながら共同で改善を行えます。
|
||||
サーバーおよびクライアント側で強力なキャッシングを行うため、アプリケーションのレイテンシを増やすことなくプロンプトの改良が可能です。
|
||||
|
||||
- **[評価](https://langfuse.com/docs/scores/overview):**
|
||||
- **[評価](https://langfuse.com/docs/evaluation/overview):**
|
||||
評価はLLMアプリケーション開発ワークフローの要であり、Langfuseは多様なニーズに対応します。
|
||||
LLMを判定者として用いる方法、ユーザーフィードバックの収集、手動によるラベリング、API/SDKを通じたカスタム評価パイプラインをサポートします。
|
||||
|
||||
- **[データセット](https://langfuse.com/docs/datasets/overview):**
|
||||
- **[データセット](https://langfuse.com/docs/evaluation/dataset-runs/datasets):**
|
||||
LLMアプリケーション評価用のテストセットやベンチマークを構築できます。
|
||||
継続的な改善、事前デプロイテスト、構造化された実験、柔軟な評価、さらにLangChainやLlamaIndexなどとのシームレスな統合をサポートします。
|
||||
|
||||
@@ -151,40 +151,40 @@ Langfuseチームによるマネージドデプロイメント。充実した無
|
||||
|
||||
### 主なインテグレーション:
|
||||
|
||||
| インテグレーション | 対応言語・環境 | 説明 |
|
||||
| ----------------------------------------------------------------------------------- | ------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| [SDK](https://langfuse.com/docs/sdk) | Python, JS/TS | SDKを利用して手動でインストゥルメンテーションを実装し、完全な柔軟性を提供します。 |
|
||||
| [OpenAI](https://langfuse.com/docs/integrations/openai) | Python, JS/TS | OpenAI SDKのドロップイン置換による自動インストゥルメンテーションを実現します。 |
|
||||
| [Langchain](https://langfuse.com/docs/integrations/langchain) | Python, JS/TS | Langchainアプリケーションにコールバックハンドラーを渡すことで自動的に計測します。 |
|
||||
| [LlamaIndex](https://langfuse.com/docs/integrations/llama-index/get-started) | Python | LlamaIndexのコールバックシステムを介して自動的にインストゥルメントします。 |
|
||||
| [Haystack](https://langfuse.com/docs/integrations/haystack) | Python | Haystackのコンテンツトレースシステムを利用した自動インストゥルメンテーションを実現します。 |
|
||||
| [LiteLLM](https://langfuse.com/docs/integrations/litellm) | Python, JS/TS (proxy only)| GPTのドロップイン置換として任意のLLMを使用できます。Azure、OpenAI、Cohere、Anthropic、Ollama、VLLM、Sagemaker、HuggingFace、Replicate(100+ LLM)に対応。 |
|
||||
| [Vercel AI SDK](https://langfuse.com/docs/integrations/vercel-ai-sdk) | JS/TS | React、Next.js、Vue、Svelte、Node.jsを使用してAI搭載アプリケーションの構築を支援するTypeScriptツールキットです。 |
|
||||
| [API](https://langfuse.com/docs/api) | | 公開APIを直接呼び出すことが可能です。OpenAPI仕様も利用できます。 |
|
||||
| インテグレーション | 対応言語・環境 | 説明 |
|
||||
| ---------------------------------------------------------------------------- | -------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| [SDK](https://langfuse.com/docs/sdk) | Python, JS/TS | SDKを利用して手動でインストゥルメンテーションを実装し、完全な柔軟性を提供します。 |
|
||||
| [OpenAI](https://langfuse.com/integrations/model-providers/openai-py) | Python, JS/TS | OpenAI SDKのドロップイン置換による自動インストゥルメンテーションを実現します。 |
|
||||
| [Langchain](https://langfuse.com/docs/integrations/langchain) | Python, JS/TS | Langchainアプリケーションにコールバックハンドラーを渡すことで自動的に計測します。 |
|
||||
| [LlamaIndex](https://langfuse.com/docs/integrations/llama-index/get-started) | Python | LlamaIndexのコールバックシステムを介して自動的にインストゥルメントします。 |
|
||||
| [Haystack](https://langfuse.com/docs/integrations/haystack) | Python | Haystackのコンテンツトレースシステムを利用した自動インストゥルメンテーションを実現します。 |
|
||||
| [LiteLLM](https://langfuse.com/docs/integrations/litellm) | Python, JS/TS (proxy only) | GPTのドロップイン置換として任意のLLMを使用できます。Azure、OpenAI、Cohere、Anthropic、Ollama、VLLM、Sagemaker、HuggingFace、Replicate(100+ LLM)に対応。 |
|
||||
| [Vercel AI SDK](https://langfuse.com/docs/integrations/vercel-ai-sdk) | JS/TS | React、Next.js、Vue、Svelte、Node.jsを使用してAI搭載アプリケーションの構築を支援するTypeScriptツールキットです。 |
|
||||
| [API](https://langfuse.com/docs/api) | | 公開APIを直接呼び出すことが可能です。OpenAPI仕様も利用できます。 |
|
||||
|
||||
### Langfuseと統合されているパッケージ:
|
||||
|
||||
| 名前 | タイプ | 説明 |
|
||||
| ------------------------------------------------------------------------- | ------------------ | --------------------------------------------------------------------------------------------------------- |
|
||||
| [Instructor](https://langfuse.com/docs/integrations/instructor) | ライブラリ | 構造化されたLLM出力(JSON、Pydantic)を取得するためのライブラリ |
|
||||
| [DSPy](https://langfuse.com/docs/integrations/dspy) | ライブラリ | LLMプロンプトや重み付けを体系的に最適化するためのフレームワーク |
|
||||
| [Mirascope](https://langfuse.com/docs/integrations/mirascope) | ライブラリ | LLMアプリケーション構築用のPythonツールキット |
|
||||
| [Ollama](https://langfuse.com/docs/integrations/ollama) | モデル(ローカル) | オープンソースLLMを手軽にローカルで実行するためのツール |
|
||||
| [Amazon Bedrock](https://langfuse.com/docs/integrations/amazon-bedrock) | モデル | AWS上でファウンデーションモデルやファインチューニング済みモデルを実行 |
|
||||
| [Google VertexAI and Gemini](https://langfuse.com/docs/integrations/google-vertex-ai) | モデル | Google上でファウンデーションモデルやファインチューニング済みモデルを実行 |
|
||||
| [AutoGen](https://langfuse.com/docs/integrations/autogen) | エージェントフレームワーク | 分散型エージェント構築のためのオープンソースLLMプラットフォーム |
|
||||
| [Flowise](https://langfuse.com/docs/integrations/flowise) | チャット/エージェント UI | JS/TSのノーコードビルダーで、カスタマイズ可能なLLMフローを構築 |
|
||||
| [Langflow](https://langfuse.com/docs/integrations/langflow) | チャット/エージェント UI | PythonベースのUIで、react-flowを用いてLangChainの実験やプロトタイピングを容易に実現 |
|
||||
| [Dify](https://langfuse.com/docs/integrations/dify) | チャット/エージェント UI | ノーコードでLLMアプリ開発が可能なオープンソースプラットフォーム |
|
||||
| [OpenWebUI](https://langfuse.com/docs/integrations/openwebui) | チャット/エージェント UI | 自前ホストおよびローカルモデルに対応するLLMチャットWeb UI |
|
||||
| [Promptfoo](https://langfuse.com/docs/integrations/promptfoo) | ツール | オープンソースのLLMテストプラットフォーム |
|
||||
| [LobeChat](https://langfuse.com/docs/integrations/lobechat) | チャット/エージェント UI | オープンソースのチャットボットプラットフォーム |
|
||||
| [Vapi](https://langfuse.com/docs/integrations/vapi) | プラットフォーム | オープンソースの音声AIプラットフォーム |
|
||||
| [Inferable](https://langfuse.com/docs/integrations/other/inferable) | エージェント | 分散型エージェント構築のためのオープンソースLLMプラットフォーム |
|
||||
| [Gradio](https://langfuse.com/docs/integrations/other/gradio) | チャット/エージェント UI | チャットUIなどのWebインターフェース構築のためのオープンソースPythonライブラリ |
|
||||
| [Goose](https://langfuse.com/docs/integrations/goose) | エージェント | 分散型エージェント構築のためのオープンソースLLMプラットフォーム |
|
||||
| [smolagents](https://langfuse.com/docs/integrations/smolagents) | エージェント | オープンソースのAIエージェントフレームワーク |
|
||||
| [CrewAI](https://langfuse.com/docs/integrations/crewai) | エージェント | エージェントの協調とツール利用を実現するマルチエージェントフレームワーク |
|
||||
| 名前 | タイプ | 説明 |
|
||||
| ------------------------------------------------------------------------------------- | -------------------------- | ----------------------------------------------------------------------------------- |
|
||||
| [Instructor](https://langfuse.com/docs/integrations/instructor) | ライブラリ | 構造化されたLLM出力(JSON、Pydantic)を取得するためのライブラリ |
|
||||
| [DSPy](https://langfuse.com/docs/integrations/dspy) | ライブラリ | LLMプロンプトや重み付けを体系的に最適化するためのフレームワーク |
|
||||
| [Mirascope](https://langfuse.com/docs/integrations/mirascope) | ライブラリ | LLMアプリケーション構築用のPythonツールキット |
|
||||
| [Ollama](https://langfuse.com/docs/integrations/ollama) | モデル(ローカル) | オープンソースLLMを手軽にローカルで実行するためのツール |
|
||||
| [Amazon Bedrock](https://langfuse.com/docs/integrations/amazon-bedrock) | モデル | AWS上でファウンデーションモデルやファインチューニング済みモデルを実行 |
|
||||
| [Google VertexAI and Gemini](https://langfuse.com/docs/integrations/google-vertex-ai) | モデル | Google上でファウンデーションモデルやファインチューニング済みモデルを実行 |
|
||||
| [AutoGen](https://langfuse.com/docs/integrations/autogen) | エージェントフレームワーク | 分散型エージェント構築のためのオープンソースLLMプラットフォーム |
|
||||
| [Flowise](https://langfuse.com/docs/integrations/flowise) | チャット/エージェント UI | JS/TSのノーコードビルダーで、カスタマイズ可能なLLMフローを構築 |
|
||||
| [Langflow](https://langfuse.com/docs/integrations/langflow) | チャット/エージェント UI | PythonベースのUIで、react-flowを用いてLangChainの実験やプロトタイピングを容易に実現 |
|
||||
| [Dify](https://langfuse.com/docs/integrations/dify) | チャット/エージェント UI | ノーコードでLLMアプリ開発が可能なオープンソースプラットフォーム |
|
||||
| [OpenWebUI](https://langfuse.com/docs/integrations/openwebui) | チャット/エージェント UI | 自前ホストおよびローカルモデルに対応するLLMチャットWeb UI |
|
||||
| [Promptfoo](https://langfuse.com/docs/integrations/promptfoo) | ツール | オープンソースのLLMテストプラットフォーム |
|
||||
| [LobeChat](https://langfuse.com/docs/integrations/lobechat) | チャット/エージェント UI | オープンソースのチャットボットプラットフォーム |
|
||||
| [Vapi](https://langfuse.com/docs/integrations/vapi) | プラットフォーム | オープンソースの音声AIプラットフォーム |
|
||||
| [Inferable](https://langfuse.com/docs/integrations/other/inferable) | エージェント | 分散型エージェント構築のためのオープンソースLLMプラットフォーム |
|
||||
| [Gradio](https://langfuse.com/docs/integrations/other/gradio) | チャット/エージェント UI | チャットUIなどのWebインターフェース構築のためのオープンソースPythonライブラリ |
|
||||
| [Goose](https://langfuse.com/docs/integrations/goose) | エージェント | 分散型エージェント構築のためのオープンソースLLMプラットフォーム |
|
||||
| [smolagents](https://langfuse.com/docs/integrations/smolagents) | エージェント | オープンソースのAIエージェントフレームワーク |
|
||||
| [CrewAI](https://langfuse.com/docs/integrations/crewai) | エージェント | エージェントの協調とツール利用を実現するマルチエージェントフレームワーク |
|
||||
|
||||
## 🚀 クイックスタート
|
||||
|
||||
@@ -200,7 +200,7 @@ Langfuseチームによるマネージドデプロイメント。充実した無
|
||||
### 2️⃣ 初めてのLLM呼び出しのログ記録
|
||||
|
||||
[`@observe()` デコレーター](https://langfuse.com/docs/sdk/python/decorators)を利用することで、任意のPython製LLMアプリケーションのトレースが簡単に行えます。
|
||||
このクイックスタートでは、Langfuseの[OpenAI統合](https://langfuse.com/docs/integrations/openai)を使用して、全てのモデルパラメータを自動で取得します。
|
||||
このクイックスタートでは、Langfuseの[OpenAI統合](https://langfuse.com/integrations/model-providers/openai-py)を使用して、全てのモデルパラメータを自動で取得します。
|
||||
|
||||
> [!TIP]
|
||||
> OpenAIを利用していない場合は、[こちらのドキュメント](https://langfuse.com/docs/get-started#log-your-first-llm-call-to-langfuse)で、他のモデルやフレームワークのログ記録方法をご確認ください。
|
||||
@@ -295,51 +295,51 @@ _[Langfuseの公開トレース例](https://cloud.langfuse.com/project/cloramnkj
|
||||
Langfuseを利用している主要なオープンソースPythonプロジェクト(スター数順): ([出典](https://github.com/langfuse/langfuse-docs/blob/main/components-mdx/dependents))
|
||||
|
||||
| リポジトリ | スター |
|
||||
| :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----: |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/127165244?s=40&v=4" width="20" height="20" alt=""> [langgenius](https://github.com/langgenius) / [dify](https://github.com/langgenius/dify) | 54865 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/158137808?s=40&v=4" width="20" height="20" alt=""> [open-webui](https://github.com/open-webui) / [open-webui](https://github.com/open-webui/open-webui) | 51531 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/131470832?s=40&v=4" width="20" height="20" alt=""> [lobehub](https://github.com/lobehub) / [lobe-chat](https://github.com/lobehub/lobe-chat) | 49003 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/85702467?s=40&v=4" width="20" height="20" alt=""> [langflow-ai](https://github.com/langflow-ai) / [langflow](https://github.com/langflow-ai/langflow) | 39093 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/130722866?s=40&v=4" width="20" height="20" alt=""> [run-llama](https://github.com/run-llama) / [llama_index](https://github.com/run-llama/llama_index) | 37368 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/139558948?s=40&v=4" width="20" height="20" alt=""> [chatchat-space](https://github.com/chatchat-space) / [Langchain-Chatchat](https://github.com/chatchat-space/Langchain-Chatchat) | 32486 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/128289781?s=40&v=4" width="20" height="20" alt=""> [FlowiseAI](https://github.com/FlowiseAI) / [Flowise](https://github.com/FlowiseAI/Flowise) | 32448 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/31035808?s=40&v=4" width="20" height="20" alt=""> [mindsdb](https://github.com/mindsdb) / [mindsdb](https://github.com/mindsdb/mindsdb) | 26931 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/119600397?s=40&v=4" width="20" height="20" alt=""> [twentyhq](https://github.com/twentyhq) / [twenty](https://github.com/twentyhq/twenty) | 24195 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/60330232?s=40&v=4" width="20" height="20" alt=""> [PostHog](https://github.com/PostHog) / [posthog](https://github.com/PostHog/posthog) | 22618 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/121462774?s=40&v=4" width="20" height="20" alt=""> [BerriAI](https://github.com/BerriAI) / [litellm](https://github.com/BerriAI/litellm) | 15151 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/179202840?s=40&v=4" width="20" height="20" alt=""> [mediar-ai](https://github.com/mediar-ai) / [screenpipe](https://github.com/mediar-ai/screenpipe) | 11037 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/105877416?s=40&v=4" width="20" height="20" alt=""> [formbricks](https://github.com/formbricks) / [formbricks](https://github.com/formbricks/formbricks) | 9386 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/76263028?s=40&v=4" width="20" height="20" alt=""> [anthropics](https://github.com/anthropics) / [courses](https://github.com/anthropics/courses) | 8385 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/78410652?s=40&v=4" width="20" height="20" alt=""> [GreyDGL](https://github.com/GreyDGL) / [PentestGPT](https://github.com/GreyDGL/PentestGPT) | 7374 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/152537519?s=40&v=4" width="20" height="20" alt=""> [superagent-ai](https://github.com/superagent-ai) / [superagent](https://github.com/superagent-ai/superagent) | 5391 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/137907881?s=40&v=4" width="20" height="20" alt=""> [promptfoo](https://github.com/promptfoo) / [promptfoo](https://github.com/promptfoo/promptfoo) | 4976 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/157326433?s=40&v=4" width="20" height="20" alt=""> [onlook-dev](https://github.com/onlook-dev) / [onlook](https://github.com/onlook-dev/onlook) | 4141 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/7250217?s=40&v=4" width="20" height="20" alt=""> [Canner](https://github.com/Canner) / [WrenAI](https://github.com/Canner/WrenAI) | 2526 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/11855343?s=40&v=4" width="20" height="20" alt=""> [pingcap](https://github.com/pingcap) / [autoflow](https://github.com/pingcap/autoflow) | 2061 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/85268109?s=40&v=4" width="20" height="20" alt=""> [MLSysOps](https://github.com/MLSysOps) / [MLE-agent](https://github.com/MLSysOps/MLE-agent) | 1161 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/158137808?s=40&v=4" width="20" height="20" alt=""> [open-webui](https://github.com/open-webui) / [pipelines](https://github.com/open-webui/pipelines) | 1100 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/18422723?s=40&v=4" width="20" height="20" alt=""> [alishobeiri](https://github.com/alishobeiri) / [thread](https://github.com/alishobeiri/thread) | 1074 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/125468716?s=40&v=4" width="20" height="20" alt=""> [topoteretes](https://github.com/topoteretes) / [cognee](https://github.com/topoteretes/cognee) | 971 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/188657705?s=40&v=4" width="20" height="20" alt=""> [bRAGAI](https://github.com/bRAGAI) / [bRAG-langchain](https://github.com/bRAGAI/bRAG-langchain) | 823 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/169500408?s=40&v=4" width="20" height="20" alt=""> [opslane](https://github.com/opslane) / [opslane](https://github.com/opslane/opslane) | 677 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/151867818?s=40&v=4" width="20" height="20" alt=""> [dynamiq-ai](https://github.com/dynamiq-ai) / [dynamiq](https://github.com/dynamiq-ai/dynamiq) | 639 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/48585267?s=40&v=4" width="20" height="20" alt=""> [theopenconversationkit](https://github.com/theopenconversationkit) / [tock](https://github.com/theopenconversationkit/tock) | 514 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/20493493?s=40&v=4" width="20" height="20" alt=""> [andysingal](https://github.com/andysingal) / [llm-course](https://github.com/andysingal/llm-course) | 394 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/132396805?s=40&v=4" width="20" height="20" alt=""> [phospho-app](https://github.com/phospho-app) / [phospho](https://github.com/phospho-app/phospho) | 384 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/178644984?s=40&v=4" width="20" height="20" alt=""> [sentient-engineering](https://github.com/sentient-engineering) / [agent-q](https://github.com/sentient-engineering/agent-q) | 370 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/168552753?s=40&v=4" width="20" height="20" alt=""> [sql-agi](https://github.com/sql-agi) / [DB-GPT](https://github.com/sql-agi/DB-GPT) | 324 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/60330232?s=40&v=4" width="20" height="20" alt=""> [PostHog](https://github.com/PostHog) / [posthog-foss](https://github.com/PostHog/posthog-foss) | 305 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/154247157?s=40&v=4" width="20" height="20" alt=""> [vespperhq](https://github.com/vespperhq) / [vespper](https://github.com/vespperhq/vespper) | 304 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/185116535?s=40&v=4" width="20" height="20" alt=""> [block](https://github.com/block) / [goose](https://github.com/block/goose) | 295 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/609489?s=40&v=4" width="20" height="20" alt=""> [aorwall](https://github.com/aorwall) / [moatless-tools](https://github.com/aorwall/moatless-tools) | 291 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/2357342?s=40&v=4" width="20" height="20" alt=""> [dmayboroda](https://github.com/dmayboroda) / [minima](https://github.com/dmayboroda/minima) | 221 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/66303003?s=40&v=4" width="20" height="20" alt=""> [RobotecAI](https://github.com/RobotecAI) / [rai](https://github.com/RobotecAI/rai) | 172 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/148684274?s=40&v=4" width="20" height="20" alt=""> [i-am-alice](https://github.com/i-am-alice) / [3rd-devs](https://github.com/i-am-alice/3rd-devs) | 148 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/171735272?s=40&v=4" width="20" height="20" alt=""> [8090-inc](https://github.com/8090-inc) / [xrx-sample-apps](https://github.com/8090-inc/xrx-sample-apps) | 138 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/104478511?s=40&v=4" width="20" height="20" alt=""> [babelcloud](https://github.com/babelcloud) / [LLM-RGB](https://github.com/babelcloud/LLM-RGB) | 135 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/15125613?s=40&v=4" width="20" height="20" alt=""> [souzatharsis](https://github.com/souzatharsis) / [tamingLLMs](https://github.com/souzatharsis/tamingLLMs) | 129 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/169401942?s=40&v=4" width="20" height="20" alt=""> [LibreChat-AI](https://github.com/LibreChat-AI) / [librechat.ai](https://github.com/LibreChat-AI/librechat.ai) | 128 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/51827949?s=40&v=4" width="20" height="20" alt=""> [deepset-ai](https://github.com/deepset-ai) / [haystack-core-integrations](https://github.com/deepset-ai/haystack-core-integrations) | 126 |
|
||||
| :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -----: |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/127165244?s=40&v=4" width="20" height="20" alt=""> [langgenius](https://github.com/langgenius) / [dify](https://github.com/langgenius/dify) | 54865 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/158137808?s=40&v=4" width="20" height="20" alt=""> [open-webui](https://github.com/open-webui) / [open-webui](https://github.com/open-webui/open-webui) | 51531 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/131470832?s=40&v=4" width="20" height="20" alt=""> [lobehub](https://github.com/lobehub) / [lobe-chat](https://github.com/lobehub/lobe-chat) | 49003 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/85702467?s=40&v=4" width="20" height="20" alt=""> [langflow-ai](https://github.com/langflow-ai) / [langflow](https://github.com/langflow-ai/langflow) | 39093 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/130722866?s=40&v=4" width="20" height="20" alt=""> [run-llama](https://github.com/run-llama) / [llama_index](https://github.com/run-llama/llama_index) | 37368 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/139558948?s=40&v=4" width="20" height="20" alt=""> [chatchat-space](https://github.com/chatchat-space) / [Langchain-Chatchat](https://github.com/chatchat-space/Langchain-Chatchat) | 32486 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/128289781?s=40&v=4" width="20" height="20" alt=""> [FlowiseAI](https://github.com/FlowiseAI) / [Flowise](https://github.com/FlowiseAI/Flowise) | 32448 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/31035808?s=40&v=4" width="20" height="20" alt=""> [mindsdb](https://github.com/mindsdb) / [mindsdb](https://github.com/mindsdb/mindsdb) | 26931 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/119600397?s=40&v=4" width="20" height="20" alt=""> [twentyhq](https://github.com/twentyhq) / [twenty](https://github.com/twentyhq/twenty) | 24195 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/60330232?s=40&v=4" width="20" height="20" alt=""> [PostHog](https://github.com/PostHog) / [posthog](https://github.com/PostHog/posthog) | 22618 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/121462774?s=40&v=4" width="20" height="20" alt=""> [BerriAI](https://github.com/BerriAI) / [litellm](https://github.com/BerriAI/litellm) | 15151 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/179202840?s=40&v=4" width="20" height="20" alt=""> [mediar-ai](https://github.com/mediar-ai) / [screenpipe](https://github.com/mediar-ai/screenpipe) | 11037 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/105877416?s=40&v=4" width="20" height="20" alt=""> [formbricks](https://github.com/formbricks) / [formbricks](https://github.com/formbricks/formbricks) | 9386 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/76263028?s=40&v=4" width="20" height="20" alt=""> [anthropics](https://github.com/anthropics) / [courses](https://github.com/anthropics/courses) | 8385 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/78410652?s=40&v=4" width="20" height="20" alt=""> [GreyDGL](https://github.com/GreyDGL) / [PentestGPT](https://github.com/GreyDGL/PentestGPT) | 7374 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/152537519?s=40&v=4" width="20" height="20" alt=""> [superagent-ai](https://github.com/superagent-ai) / [superagent](https://github.com/superagent-ai/superagent) | 5391 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/137907881?s=40&v=4" width="20" height="20" alt=""> [promptfoo](https://github.com/promptfoo) / [promptfoo](https://github.com/promptfoo/promptfoo) | 4976 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/157326433?s=40&v=4" width="20" height="20" alt=""> [onlook-dev](https://github.com/onlook-dev) / [onlook](https://github.com/onlook-dev/onlook) | 4141 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/7250217?s=40&v=4" width="20" height="20" alt=""> [Canner](https://github.com/Canner) / [WrenAI](https://github.com/Canner/WrenAI) | 2526 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/11855343?s=40&v=4" width="20" height="20" alt=""> [pingcap](https://github.com/pingcap) / [autoflow](https://github.com/pingcap/autoflow) | 2061 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/85268109?s=40&v=4" width="20" height="20" alt=""> [MLSysOps](https://github.com/MLSysOps) / [MLE-agent](https://github.com/MLSysOps/MLE-agent) | 1161 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/158137808?s=40&v=4" width="20" height="20" alt=""> [open-webui](https://github.com/open-webui) / [pipelines](https://github.com/open-webui/pipelines) | 1100 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/18422723?s=40&v=4" width="20" height="20" alt=""> [alishobeiri](https://github.com/alishobeiri) / [thread](https://github.com/alishobeiri/thread) | 1074 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/125468716?s=40&v=4" width="20" height="20" alt=""> [topoteretes](https://github.com/topoteretes) / [cognee](https://github.com/topoteretes/cognee) | 971 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/188657705?s=40&v=4" width="20" height="20" alt=""> [bRAGAI](https://github.com/bRAGAI) / [bRAG-langchain](https://github.com/bRAGAI/bRAG-langchain) | 823 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/169500408?s=40&v=4" width="20" height="20" alt=""> [opslane](https://github.com/opslane) / [opslane](https://github.com/opslane/opslane) | 677 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/151867818?s=40&v=4" width="20" height="20" alt=""> [dynamiq-ai](https://github.com/dynamiq-ai) / [dynamiq](https://github.com/dynamiq-ai/dynamiq) | 639 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/48585267?s=40&v=4" width="20" height="20" alt=""> [theopenconversationkit](https://github.com/theopenconversationkit) / [tock](https://github.com/theopenconversationkit/tock) | 514 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/20493493?s=40&v=4" width="20" height="20" alt=""> [andysingal](https://github.com/andysingal) / [llm-course](https://github.com/andysingal/llm-course) | 394 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/132396805?s=40&v=4" width="20" height="20" alt=""> [phospho-app](https://github.com/phospho-app) / [phospho](https://github.com/phospho-app/phospho) | 384 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/178644984?s=40&v=4" width="20" height="20" alt=""> [sentient-engineering](https://github.com/sentient-engineering) / [agent-q](https://github.com/sentient-engineering/agent-q) | 370 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/168552753?s=40&v=4" width="20" height="20" alt=""> [sql-agi](https://github.com/sql-agi) / [DB-GPT](https://github.com/sql-agi/DB-GPT) | 324 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/60330232?s=40&v=4" width="20" height="20" alt=""> [PostHog](https://github.com/PostHog) / [posthog-foss](https://github.com/PostHog/posthog-foss) | 305 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/154247157?s=40&v=4" width="20" height="20" alt=""> [vespperhq](https://github.com/vespperhq) / [vespper](https://github.com/vespperhq/vespper) | 304 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/185116535?s=40&v=4" width="20" height="20" alt=""> [block](https://github.com/block) / [goose](https://github.com/block/goose) | 295 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/609489?s=40&v=4" width="20" height="20" alt=""> [aorwall](https://github.com/aorwall) / [moatless-tools](https://github.com/aorwall/moatless-tools) | 291 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/2357342?s=40&v=4" width="20" height="20" alt=""> [dmayboroda](https://github.com/dmayboroda) / [minima](https://github.com/dmayboroda/minima) | 221 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/66303003?s=40&v=4" width="20" height="20" alt=""> [RobotecAI](https://github.com/RobotecAI) / [rai](https://github.com/RobotecAI/rai) | 172 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/148684274?s=40&v=4" width="20" height="20" alt=""> [i-am-alice](https://github.com/i-am-alice) / [3rd-devs](https://github.com/i-am-alice/3rd-devs) | 148 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/171735272?s=40&v=4" width="20" height="20" alt=""> [8090-inc](https://github.com/8090-inc) / [xrx-sample-apps](https://github.com/8090-inc/xrx-sample-apps) | 138 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/104478511?s=40&v=4" width="20" height="20" alt=""> [babelcloud](https://github.com/babelcloud) / [LLM-RGB](https://github.com/babelcloud/LLM-RGB) | 135 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/15125613?s=40&v=4" width="20" height="20" alt=""> [souzatharsis](https://github.com/souzatharsis) / [tamingLLMs](https://github.com/souzatharsis/tamingLLMs) | 129 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/169401942?s=40&v=4" width="20" height="20" alt=""> [LibreChat-AI](https://github.com/LibreChat-AI) / [librechat.ai](https://github.com/LibreChat-AI/librechat.ai) | 128 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/51827949?s=40&v=4" width="20" height="20" alt=""> [deepset-ai](https://github.com/deepset-ai) / [haystack-core-integrations](https://github.com/deepset-ai/haystack-core-integrations) | 126 |
|
||||
|
||||
## 🔒 セキュリティとプライバシー
|
||||
|
||||
|
||||
+35
-34
@@ -138,40 +138,40 @@ Langfuse 팀이 관리하는 배포 방식으로, 후한 무료 플랜(취미
|
||||
|
||||
### 주요 통합:
|
||||
|
||||
| 통합 | 지원 | 설명 |
|
||||
| --------------------------------------------------------------------- | ---------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| [SDK](https://langfuse.com/docs/sdk) | Python, JS/TS | SDK를 사용하여 완전한 유연성을 갖춘 수동 계측(manual instrumentation)을 수행합니다. |
|
||||
| [OpenAI](https://langfuse.com/docs/integrations/openai) | Python, JS/TS | OpenAI SDK의 드롭인 대체(drop-in replacement)를 통해 자동 계측(automated instrumentation)을 수행합니다. |
|
||||
| [Langchain](https://langfuse.com/docs/integrations/langchain) | Python, JS/TS | Langchain 애플리케이션에 callback 핸들러를 전달하여 자동 계측합니다. |
|
||||
| [LlamaIndex](https://langfuse.com/docs/integrations/llama-index/get-started) | Python | LlamaIndex 콜백 시스템을 통한 자동 계측을 지원합니다. |
|
||||
| [Haystack](https://langfuse.com/docs/integrations/haystack) | Python | Haystack 콘텐츠 추적 시스템을 통한 자동 계측을 지원합니다. |
|
||||
| [LiteLLM](https://langfuse.com/docs/integrations/litellm) | Python, JS/TS (proxy only) | GPT의 드롭인 대체품으로 어떤 LLM도 사용할 수 있습니다. Azure, OpenAI, Cohere, Anthropic, Ollama, VLLM, Sagemaker, HuggingFace, Replicate 등 100개 이상의 LLM 지원. |
|
||||
| [Vercel AI SDK](https://langfuse.com/docs/integrations/vercel-ai-sdk) | JS/TS | React, Next.js, Vue, Svelte, Node.js와 함께 AI 기반 애플리케이션 구축을 돕는 TypeScript 툴킷입니다. |
|
||||
| [API](https://langfuse.com/docs/api) | | 공개 API를 직접 호출합니다. OpenAPI 명세가 제공됩니다. |
|
||||
| 통합 | 지원 | 설명 |
|
||||
| ---------------------------------------------------------------------------- | -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||
| [SDK](https://langfuse.com/docs/sdk) | Python, JS/TS | SDK를 사용하여 완전한 유연성을 갖춘 수동 계측(manual instrumentation)을 수행합니다. |
|
||||
| [OpenAI](https://langfuse.com/integrations/model-providers/openai-py) | Python, JS/TS | OpenAI SDK의 드롭인 대체(drop-in replacement)를 통해 자동 계측(automated instrumentation)을 수행합니다. |
|
||||
| [Langchain](https://langfuse.com/docs/integrations/langchain) | Python, JS/TS | Langchain 애플리케이션에 callback 핸들러를 전달하여 자동 계측합니다. |
|
||||
| [LlamaIndex](https://langfuse.com/docs/integrations/llama-index/get-started) | Python | LlamaIndex 콜백 시스템을 통한 자동 계측을 지원합니다. |
|
||||
| [Haystack](https://langfuse.com/docs/integrations/haystack) | Python | Haystack 콘텐츠 추적 시스템을 통한 자동 계측을 지원합니다. |
|
||||
| [LiteLLM](https://langfuse.com/docs/integrations/litellm) | Python, JS/TS (proxy only) | GPT의 드롭인 대체품으로 어떤 LLM도 사용할 수 있습니다. Azure, OpenAI, Cohere, Anthropic, Ollama, VLLM, Sagemaker, HuggingFace, Replicate 등 100개 이상의 LLM 지원. |
|
||||
| [Vercel AI SDK](https://langfuse.com/docs/integrations/vercel-ai-sdk) | JS/TS | React, Next.js, Vue, Svelte, Node.js와 함께 AI 기반 애플리케이션 구축을 돕는 TypeScript 툴킷입니다. |
|
||||
| [API](https://langfuse.com/docs/api) | | 공개 API를 직접 호출합니다. OpenAPI 명세가 제공됩니다. |
|
||||
|
||||
### Langfuse와 통합된 패키지:
|
||||
|
||||
| 이름 | 유형 | 설명 |
|
||||
| ----------------------------------------------------------------------- | ------------------ | ---------------------------------------------------------------------------------------------------------------- |
|
||||
| [Instructor](https://langfuse.com/docs/integrations/instructor) | 라이브러리 | 구조화된 LLM 출력을(JSON, Pydantic) 얻기 위한 라이브러리입니다. |
|
||||
| [DSPy](https://langfuse.com/docs/integrations/dspy) | 라이브러리 | 언어 모델 프롬프트와 가중치를 체계적으로 최적화하는 프레임워크입니다. |
|
||||
| [Mirascope](https://langfuse.com/docs/integrations/mirascope) | 라이브러리 | LLM 애플리케이션 구축을 위한 Python 툴킷입니다. |
|
||||
| [Ollama](https://langfuse.com/docs/integrations/ollama) | 모델 (로컬) | 자신의 컴퓨터에서 오픈 소스 LLM을 손쉽게 실행할 수 있습니다. |
|
||||
| [Amazon Bedrock](https://langfuse.com/docs/integrations/amazon-bedrock) | 모델 | AWS에서 기본 및 파인튜닝된 모델을 실행합니다. |
|
||||
| [Google VertexAI and Gemini](https://langfuse.com/docs/integrations/google-vertex-ai) | 모델 | Google에서 기본 및 파인튜닝된 모델을 실행합니다. |
|
||||
| [AutoGen](https://langfuse.com/docs/integrations/autogen) | 에이전트 프레임워크 | 분산 에이전트 구축을 위한 오픈 소스 LLM 플랫폼입니다. |
|
||||
| [Flowise](https://langfuse.com/docs/integrations/flowise) | 채팅/에이전트 UI | 맞춤형 LLM 플로우를 위한 JS/TS 코드 없는(no-code) 빌더입니다. |
|
||||
| [Langflow](https://langfuse.com/docs/integrations/langflow) | 채팅/에이전트 UI | react-flow를 활용하여 실험 및 프로토타이핑을 손쉽게 할 수 있도록 디자인된 LangChain용 Python 기반 UI입니다. |
|
||||
| [Dify](https://langfuse.com/docs/integrations/dify) | 채팅/에이전트 UI | 코드 없는 빌더와 함께 제공되는 오픈 소스 LLM 애플리케이션 개발 플랫폼입니다. |
|
||||
| [OpenWebUI](https://langfuse.com/docs/integrations/openwebui) | 채팅/에이전트 UI | 셀프 호스팅 및 로컬 모델 등 다양한 LLM 실행기를 지원하는 셀프 호스팅 LLM 채팅 웹 UI입니다. |
|
||||
| [Promptfoo](https://langfuse.com/docs/integrations/promptfoo) | 도구 | 오픈 소스 LLM 테스트 플랫폼입니다. |
|
||||
| [LobeChat](https://langfuse.com/docs/integrations/lobechat) | 채팅/에이전트 UI | 오픈 소스 챗봇 플랫폼입니다. |
|
||||
| [Vapi](https://langfuse.com/docs/integrations/vapi) | 플랫폼 | 오픈 소스 음성 AI 플랫폼입니다. |
|
||||
| [Inferable](https://langfuse.com/docs/integrations/other/inferable) | 에이전트 | 분산 에이전트 구축을 위한 오픈 소스 LLM 플랫폼입니다. |
|
||||
| [Gradio](https://langfuse.com/docs/integrations/other/gradio) | 채팅/에이전트 UI | 채팅 UI와 같은 웹 인터페이스 구축을 위한 오픈 소스 Python 라이브러리입니다. |
|
||||
| [Goose](https://langfuse.com/docs/integrations/goose) | 에이전트 | 분산 에이전트 구축을 위한 오픈 소스 LLM 플랫폼입니다. |
|
||||
| [smolagents](https://langfuse.com/docs/integrations/smolagents) | 에이전트 | 오픈 소스 AI 에이전트 프레임워크입니다. |
|
||||
| [CrewAI](https://langfuse.com/docs/integrations/crewai) | 에이전트 | 에이전트 간 협업 및 도구 사용을 위한 다중 에이전트 프레임워크입니다. |
|
||||
| 이름 | 유형 | 설명 |
|
||||
| ------------------------------------------------------------------------------------- | ------------------- | ----------------------------------------------------------------------------------------------------------- |
|
||||
| [Instructor](https://langfuse.com/docs/integrations/instructor) | 라이브러리 | 구조화된 LLM 출력을(JSON, Pydantic) 얻기 위한 라이브러리입니다. |
|
||||
| [DSPy](https://langfuse.com/docs/integrations/dspy) | 라이브러리 | 언어 모델 프롬프트와 가중치를 체계적으로 최적화하는 프레임워크입니다. |
|
||||
| [Mirascope](https://langfuse.com/docs/integrations/mirascope) | 라이브러리 | LLM 애플리케이션 구축을 위한 Python 툴킷입니다. |
|
||||
| [Ollama](https://langfuse.com/docs/integrations/ollama) | 모델 (로컬) | 자신의 컴퓨터에서 오픈 소스 LLM을 손쉽게 실행할 수 있습니다. |
|
||||
| [Amazon Bedrock](https://langfuse.com/docs/integrations/amazon-bedrock) | 모델 | AWS에서 기본 및 파인튜닝된 모델을 실행합니다. |
|
||||
| [Google VertexAI and Gemini](https://langfuse.com/docs/integrations/google-vertex-ai) | 모델 | Google에서 기본 및 파인튜닝된 모델을 실행합니다. |
|
||||
| [AutoGen](https://langfuse.com/docs/integrations/autogen) | 에이전트 프레임워크 | 분산 에이전트 구축을 위한 오픈 소스 LLM 플랫폼입니다. |
|
||||
| [Flowise](https://langfuse.com/docs/integrations/flowise) | 채팅/에이전트 UI | 맞춤형 LLM 플로우를 위한 JS/TS 코드 없는(no-code) 빌더입니다. |
|
||||
| [Langflow](https://langfuse.com/docs/integrations/langflow) | 채팅/에이전트 UI | react-flow를 활용하여 실험 및 프로토타이핑을 손쉽게 할 수 있도록 디자인된 LangChain용 Python 기반 UI입니다. |
|
||||
| [Dify](https://langfuse.com/docs/integrations/dify) | 채팅/에이전트 UI | 코드 없는 빌더와 함께 제공되는 오픈 소스 LLM 애플리케이션 개발 플랫폼입니다. |
|
||||
| [OpenWebUI](https://langfuse.com/docs/integrations/openwebui) | 채팅/에이전트 UI | 셀프 호스팅 및 로컬 모델 등 다양한 LLM 실행기를 지원하는 셀프 호스팅 LLM 채팅 웹 UI입니다. |
|
||||
| [Promptfoo](https://langfuse.com/docs/integrations/promptfoo) | 도구 | 오픈 소스 LLM 테스트 플랫폼입니다. |
|
||||
| [LobeChat](https://langfuse.com/docs/integrations/lobechat) | 채팅/에이전트 UI | 오픈 소스 챗봇 플랫폼입니다. |
|
||||
| [Vapi](https://langfuse.com/docs/integrations/vapi) | 플랫폼 | 오픈 소스 음성 AI 플랫폼입니다. |
|
||||
| [Inferable](https://langfuse.com/docs/integrations/other/inferable) | 에이전트 | 분산 에이전트 구축을 위한 오픈 소스 LLM 플랫폼입니다. |
|
||||
| [Gradio](https://langfuse.com/docs/integrations/other/gradio) | 채팅/에이전트 UI | 채팅 UI와 같은 웹 인터페이스 구축을 위한 오픈 소스 Python 라이브러리입니다. |
|
||||
| [Goose](https://langfuse.com/docs/integrations/goose) | 에이전트 | 분산 에이전트 구축을 위한 오픈 소스 LLM 플랫폼입니다. |
|
||||
| [smolagents](https://langfuse.com/docs/integrations/smolagents) | 에이전트 | 오픈 소스 AI 에이전트 프레임워크입니다. |
|
||||
| [CrewAI](https://langfuse.com/docs/integrations/crewai) | 에이전트 | 에이전트 간 협업 및 도구 사용을 위한 다중 에이전트 프레임워크입니다. |
|
||||
|
||||
## 🚀 빠른 시작
|
||||
|
||||
@@ -185,7 +185,7 @@ Langfuse 팀이 관리하는 배포 방식으로, 후한 무료 플랜(취미
|
||||
|
||||
### 2️⃣ 첫 번째 LLM 호출 기록하기
|
||||
|
||||
[`@observe()` 데코레이터](https://langfuse.com/docs/sdk/python/decorators)를 사용하면 Python LLM 애플리케이션의 추적이 매우 간편해집니다. 이 빠른 시작 예제에서는 Langfuse [OpenAI 통합](https://langfuse.com/docs/integrations/openai)을 사용하여 모든 모델 파라미터를 자동으로 캡처합니다.
|
||||
[`@observe()` 데코레이터](https://langfuse.com/docs/sdk/python/decorators)를 사용하면 Python LLM 애플리케이션의 추적이 매우 간편해집니다. 이 빠른 시작 예제에서는 Langfuse [OpenAI 통합](https://langfuse.com/integrations/model-providers/openai-py)을 사용하여 모든 모델 파라미터를 자동으로 캡처합니다.
|
||||
|
||||
> [!TIP]
|
||||
> OpenAI를 사용하지 않으시다면, 다른 모델 및 프레임워크의 로그 기록 방법은 [문서](https://langfuse.com/docs/get-started#log-your-first-llm-call-to-langfuse)를 참조하세요.
|
||||
@@ -276,8 +276,8 @@ _[Langfuse의 공개 예제 trace](https://cloud.langfuse.com/project/cloramnkj0
|
||||
|
||||
별(star) 수를 기준으로 순위가 매겨진 Langfuse를 사용하는 상위 오픈 소스 Python 프로젝트들 ([출처](https://github.com/langfuse/langfuse-docs/blob/main/components-mdx/dependents)):
|
||||
|
||||
| 저장소 | 별 |
|
||||
| :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---: |
|
||||
| 저장소 | 별 |
|
||||
| :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----: |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/127165244?s=40&v=4" width="20" height="20" alt=""> [langgenius](https://github.com/langgenius) / [dify](https://github.com/langgenius/dify) | 54865 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/158137808?s=40&v=4" width="20" height="20" alt=""> [open-webui](https://github.com/open-webui) / [open-webui](https://github.com/open-webui/open-webui) | 51531 |
|
||||
| <img class="avatar mr-2" src="https://avatars.githubusercontent.com/u/131470832?s=40&v=4" width="20" height="20" alt=""> [lobehub](https://github.com/lobehub) / [lobe-chat](https://github.com/lobehub/lobe-chat) | 49003 |
|
||||
@@ -332,6 +332,7 @@ _[Langfuse의 공개 예제 trace](https://cloud.langfuse.com/project/cloramnkj0
|
||||
기본적으로 Langfuse는 자체 호스팅 인스턴스의 기본 사용 통계를 중앙 서버(PostHog)로 자동 보고합니다.
|
||||
|
||||
이를 통해:
|
||||
|
||||
1. Langfuse가 어떻게 사용되는지 이해하고, 가장 관련성 높은 기능을 개선할 수 있습니다.
|
||||
2. 내부 및 외부(예: 자금 조달) 보고를 위한 전체 사용량을 추적할 수 있습니다.
|
||||
|
||||
|
||||
@@ -80,11 +80,11 @@ Langfuse is an **open source LLM engineering** platform. It helps teams collabor
|
||||
|
||||
- [LLM Application Observability](https://langfuse.com/docs/tracing): Instrument your app and start ingesting traces to Langfuse, thereby tracking LLM calls and other relevant logic in your app such as retrieval, embedding, or agent actions. Inspect and debug complex logs and user sessions. Try the interactive [demo](https://langfuse.com/docs/demo) to see this in action.
|
||||
|
||||
- [Prompt Management](https://langfuse.com/docs/prompts/get-started) helps you centrally manage, version control, and collaboratively iterate on your prompts. Thanks to strong caching on server and client side, you can iterate on prompts without adding latency to your application.
|
||||
- [Prompt Management](https://langfuse.com/docs/prompt-management/get-started) helps you centrally manage, version control, and collaboratively iterate on your prompts. Thanks to strong caching on server and client side, you can iterate on prompts without adding latency to your application.
|
||||
|
||||
- [Evaluations](https://langfuse.com/docs/scores/overview) are key to the LLM application development workflow, and Langfuse adapts to your needs. It supports LLM-as-a-judge, user feedback collection, manual labeling, and custom evaluation pipelines via APIs/SDKs.
|
||||
- [Evaluations](https://langfuse.com/docs/evaluation/overview) are key to the LLM application development workflow, and Langfuse adapts to your needs. It supports LLM-as-a-judge, user feedback collection, manual labeling, and custom evaluation pipelines via APIs/SDKs.
|
||||
|
||||
- [Datasets](https://langfuse.com/docs/datasets/overview) enable test sets and benchmarks for evaluating your LLM application. They support continuous improvement, pre-deployment testing, structured experiments, flexible evaluation, and seamless integration with frameworks like LangChain and LlamaIndex.
|
||||
- [Datasets](https://langfuse.com/docs/evaluation/dataset-runs/datasets) enable test sets and benchmarks for evaluating your LLM application. They support continuous improvement, pre-deployment testing, structured experiments, flexible evaluation, and seamless integration with frameworks like LangChain and LlamaIndex.
|
||||
|
||||
- [LLM Playground](https://langfuse.com/docs/playground) is a tool for testing and iterating on your prompts and model configurations, shortening the feedback loop and accelerating development. When you see a bad result in tracing, you can directly jump to the playground to iterate on it.
|
||||
|
||||
@@ -118,6 +118,7 @@ Run Langfuse on your own infrastructure:
|
||||
# Run the langfuse docker compose
|
||||
docker compose up
|
||||
```
|
||||
|
||||
- [VM](https://langfuse.com/self-hosting/docker-compose): Run Langfuse on a single Virtual Machine using Docker Compose.
|
||||
- [Kubernetes (Helm)](https://langfuse.com/self-hosting/kubernetes-helm): Run Langfuse on a Kubernetes cluster using Helm. This is the preferred production deployment.
|
||||
- Terraform Templates: [AWS](https://langfuse.com/self-hosting/aws), [Azure](https://langfuse.com/self-hosting/azure), [GCP](https://langfuse.com/self-hosting/gcp)
|
||||
@@ -133,7 +134,7 @@ See [self-hosting documentation](https://langfuse.com/self-hosting) to learn mor
|
||||
| Integration | Supports | Description |
|
||||
| ---------------------------------------------------------------------------- | -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||
| [SDK](https://langfuse.com/docs/sdk) | Python, JS/TS | Manual instrumentation using the SDKs for full flexibility. |
|
||||
| [OpenAI](https://langfuse.com/docs/integrations/openai) | Python, JS/TS | Automated instrumentation using drop-in replacement of OpenAI SDK. |
|
||||
| [OpenAI](https://langfuse.com/integrations/model-providers/openai-py) | Python, JS/TS | Automated instrumentation using drop-in replacement of OpenAI SDK. |
|
||||
| [Langchain](https://langfuse.com/docs/integrations/langchain) | Python, JS/TS | Automated instrumentation by passing callback handler to Langchain application. |
|
||||
| [LlamaIndex](https://langfuse.com/docs/integrations/llama-index/get-started) | Python | Automated instrumentation via LlamaIndex callback system. |
|
||||
| [Haystack](https://langfuse.com/docs/integrations/haystack) | Python | Automated instrumentation via Haystack content tracing system. |
|
||||
@@ -176,7 +177,7 @@ Instrument your app and start ingesting traces to Langfuse, thereby tracking LLM
|
||||
|
||||
### 2️⃣ Log your first LLM call
|
||||
|
||||
The [`@observe()` decorator](https://langfuse.com/docs/sdk/python/decorators) makes it easy to trace any Python LLM application. In this quickstart we also use the Langfuse [OpenAI integration](https://langfuse.com/docs/integrations/openai) to automatically capture all model parameters.
|
||||
The [`@observe()` decorator](https://langfuse.com/docs/sdk/python/decorators) makes it easy to trace any Python LLM application. In this quickstart we also use the Langfuse [OpenAI integration](https://langfuse.com/integrations/model-providers/openai-py) to automatically capture all model parameters.
|
||||
|
||||
> [!TIP]
|
||||
> Not using OpenAI? Visit [our documentation](https://langfuse.com/docs/get-started#log-your-first-llm-call-to-langfuse) to learn how to log other models and frameworks.
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
# Code Review Instructions
|
||||
|
||||
## Database Migrations
|
||||
|
||||
### ClickHouse
|
||||
|
||||
- ClickHouse migrations in the `packages/shared/clickhouse/migrations/clustered` directory should include `ON CLUSTER default` and should use `Replicated` merge tree table types.
|
||||
- E.g. `ReplacingMergeTree` is likely an error while `ReplicatedReplacingMergeTree` would be correct in most cases.
|
||||
- ClickHouse migrations in the `packages/shared/clickhouse/migrations/unclustered` directory must not include `ON CLUSTER` statements and must not use `Replicated` merge tree table types.
|
||||
- Migrations in `packages/shared/clickhouse/migrations/clustered` should match their counterparts in `packages/shared/clickhouse/migrations/unclustered` aside from the restrictions listed above.
|
||||
- When adding new indexes on ClickHouse, ensure that there is a corresponding `MATERIALIZE INDEX` statement in the same migration. The materialization can use `SETTINGS mutations_sync = 2` if they operate on smaller tables, but may timeout otherwise.
|
||||
|
||||
### Postgres
|
||||
|
||||
- Most `schema.prisma` changes should produce a change in `packages/shared/prisma/migrations`.
|
||||
@@ -26,7 +26,6 @@
|
||||
"dependencies": {
|
||||
"@langfuse/shared": "workspace:*",
|
||||
"@opentelemetry/api": ">=1.0.0 <1.10.0",
|
||||
"axios": "^1.8.2",
|
||||
"https-proxy-agent": "^7.0.6",
|
||||
"next": "^14.2.30",
|
||||
"next-auth": "^4.24.11",
|
||||
|
||||
@@ -22,6 +22,13 @@ service:
|
||||
docs: limit of items per page
|
||||
response: PaginatedAnnotationQueues
|
||||
|
||||
createQueue:
|
||||
docs: Create an annotation queue
|
||||
method: POST
|
||||
path: /annotation-queues
|
||||
request: CreateAnnotationQueueRequest
|
||||
response: AnnotationQueue
|
||||
|
||||
getQueue:
|
||||
docs: Get an annotation queue by ID
|
||||
method: GET
|
||||
@@ -105,6 +112,28 @@ service:
|
||||
docs: The unique identifier of the annotation queue item
|
||||
response: DeleteAnnotationQueueItemResponse
|
||||
|
||||
createQueueAssignment:
|
||||
docs: Create an assignment for a user to an annotation queue
|
||||
method: POST
|
||||
path: /annotation-queues/{queueId}/assignments
|
||||
path-parameters:
|
||||
queueId:
|
||||
type: string
|
||||
docs: The unique identifier of the annotation queue
|
||||
request: AnnotationQueueAssignmentRequest
|
||||
response: CreateAnnotationQueueAssignmentResponse
|
||||
|
||||
deleteQueueAssignment:
|
||||
docs: Delete an assignment for a user to an annotation queue
|
||||
method: DELETE
|
||||
path: /annotation-queues/{queueId}/assignments
|
||||
path-parameters:
|
||||
queueId:
|
||||
type: string
|
||||
docs: The unique identifier of the annotation queue
|
||||
request: AnnotationQueueAssignmentRequest
|
||||
response: DeleteAnnotationQueueAssignmentResponse
|
||||
|
||||
types:
|
||||
AnnotationQueueStatus:
|
||||
enum:
|
||||
@@ -146,6 +175,12 @@ types:
|
||||
data: list<AnnotationQueueItem>
|
||||
meta: pagination.MetaResponse
|
||||
|
||||
CreateAnnotationQueueRequest:
|
||||
properties:
|
||||
name: string
|
||||
description: optional<string>
|
||||
scoreConfigIds: list<string>
|
||||
|
||||
CreateAnnotationQueueItemRequest:
|
||||
properties:
|
||||
objectId: string
|
||||
@@ -163,3 +198,17 @@ types:
|
||||
properties:
|
||||
success: boolean
|
||||
message: string
|
||||
|
||||
AnnotationQueueAssignmentRequest:
|
||||
properties:
|
||||
userId: string
|
||||
|
||||
DeleteAnnotationQueueAssignmentResponse:
|
||||
properties:
|
||||
success: boolean
|
||||
|
||||
CreateAnnotationQueueAssignmentResponse:
|
||||
properties:
|
||||
userId: string
|
||||
queueId: string
|
||||
projectId: string
|
||||
|
||||
@@ -19,7 +19,7 @@ service:
|
||||
I.e. if you want to update a trace, you'd use the same body id, but separate event IDs.
|
||||
|
||||
Notes:
|
||||
- Introduction to data model: https://langfuse.com/docs/tracing-data-model
|
||||
- Introduction to data model: https://langfuse.com/docs/observability/data-model
|
||||
- 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
|
||||
@@ -145,6 +145,13 @@ types:
|
||||
- SPAN
|
||||
- GENERATION
|
||||
- EVENT
|
||||
- AGENT
|
||||
- TOOL
|
||||
- CHAIN
|
||||
- RETRIEVER
|
||||
- EVALUATOR
|
||||
- EMBEDDING
|
||||
- GUARDRAIL
|
||||
|
||||
IngestionUsage:
|
||||
discriminated: false
|
||||
|
||||
@@ -20,6 +20,13 @@ service:
|
||||
request: MembershipRequest
|
||||
response: MembershipResponse
|
||||
|
||||
deleteOrganizationMembership:
|
||||
docs: Delete a membership from the organization associated with the API key (requires organization-scoped API key)
|
||||
method: DELETE
|
||||
path: /organizations/memberships
|
||||
request: DeleteMembershipRequest
|
||||
response: MembershipDeletionResponse
|
||||
|
||||
getProjectMemberships:
|
||||
docs: Get all memberships for a specific project (requires organization-scoped API key)
|
||||
method: GET
|
||||
@@ -37,6 +44,15 @@ service:
|
||||
request: MembershipRequest
|
||||
response: MembershipResponse
|
||||
|
||||
deleteProjectMembership:
|
||||
docs: Delete a membership from a specific project (requires organization-scoped API key). The user must be a member of the organization.
|
||||
method: DELETE
|
||||
path: /projects/{projectId}/memberships
|
||||
path-parameters:
|
||||
projectId: string
|
||||
request: DeleteMembershipRequest
|
||||
response: MembershipDeletionResponse
|
||||
|
||||
getOrganizationProjects:
|
||||
docs: Get all projects for the organization associated with the API key (requires organization-scoped API key)
|
||||
method: GET
|
||||
@@ -56,6 +72,10 @@ types:
|
||||
userId: string
|
||||
role: MembershipRole
|
||||
|
||||
DeleteMembershipRequest:
|
||||
properties:
|
||||
userId: string
|
||||
|
||||
MembershipResponse:
|
||||
properties:
|
||||
userId: string
|
||||
@@ -63,6 +83,11 @@ types:
|
||||
email: string
|
||||
name: string
|
||||
|
||||
MembershipDeletionResponse:
|
||||
properties:
|
||||
message: string
|
||||
userId: string
|
||||
|
||||
MembershipsResponse:
|
||||
properties:
|
||||
memberships: list<MembershipResponse>
|
||||
|
||||
+4
-3
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "langfuse",
|
||||
"version": "3.94.0",
|
||||
"version": "3.99.0",
|
||||
"author": "engineering@langfuse.com",
|
||||
"license": "MIT",
|
||||
"private": true,
|
||||
@@ -40,7 +40,7 @@
|
||||
"husky": "^9.0.11",
|
||||
"prettier": "^3.6.2",
|
||||
"release-it": "^19.0.3",
|
||||
"turbo": "^2.5.5"
|
||||
"turbo": "^2.5.6"
|
||||
},
|
||||
"release-it": {
|
||||
"git": {
|
||||
@@ -91,7 +91,8 @@
|
||||
"nanoid": "^3.3.8",
|
||||
"katex": "^0.16.21",
|
||||
"tar-fs": "^2.1.2",
|
||||
"rollup@^4.0.0": "^4.22.4"
|
||||
"rollup@^4.0.0": "^4.22.4",
|
||||
"@types/node-fetch": "^2.6.13"
|
||||
},
|
||||
"patchedDependencies": {
|
||||
"next-auth@4.24.11": "patches/next-auth@4.24.11.patch"
|
||||
|
||||
@@ -41,6 +41,14 @@ module.exports = {
|
||||
// https://typescript-eslint.io/troubleshooting/faqs/eslint/#i-get-errors-from-the-no-undef-rule-about-global-variables-not-being-defined-even-though-there-are-no-typescript-errors
|
||||
rules: {
|
||||
"no-undef": "off",
|
||||
"no-restricted-globals": [
|
||||
"error",
|
||||
{
|
||||
name: "redis",
|
||||
message:
|
||||
"Import redis explicitly from '@langfuse/shared/src/server' instead of using global.",
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
"@vercel/style-guide": "^6.0.0",
|
||||
"eslint-config-next": "^14.2.15",
|
||||
"eslint-config-prettier": "^9.1.0",
|
||||
"eslint-config-turbo": "^2.5.5",
|
||||
"eslint-config-turbo": "^2.5.6",
|
||||
"eslint-plugin-only-warn": "^1.1.0",
|
||||
"typescript": "^5.4.5"
|
||||
}
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
DROP TABLE dataset_run_items_rmt ON CLUSTER default;
|
||||
@@ -0,0 +1,36 @@
|
||||
CREATE TABLE dataset_run_items_rmt ON CLUSTER default (
|
||||
-- primary identifiers
|
||||
`id` String,
|
||||
`project_id` String,
|
||||
`dataset_run_id` String,
|
||||
`dataset_item_id` String,
|
||||
`dataset_id` String,
|
||||
`trace_id` String,
|
||||
`observation_id` Nullable(String),
|
||||
|
||||
-- error field
|
||||
`error` Nullable(String),
|
||||
|
||||
-- timestamps
|
||||
`created_at` DateTime64(3) DEFAULT now(),
|
||||
`updated_at` DateTime64(3) DEFAULT now(),
|
||||
|
||||
-- denormalized immutable dataset run fields
|
||||
`dataset_run_name` String,
|
||||
`dataset_run_description` Nullable(String),
|
||||
`dataset_run_metadata` Map(LowCardinality(String), String),
|
||||
`dataset_run_created_at` DateTime64(3),
|
||||
|
||||
-- denormalized dataset item fields (mutable, but snapshots are relevant)
|
||||
`dataset_item_input` Nullable(String) CODEC(ZSTD(3)), -- json
|
||||
`dataset_item_expected_output` Nullable(String) CODEC(ZSTD(3)), -- json
|
||||
`dataset_item_metadata` Map(LowCardinality(String), String),
|
||||
|
||||
-- clickhouse engine fields
|
||||
`event_ts` DateTime64(3),
|
||||
`is_deleted` UInt8,
|
||||
|
||||
-- For dataset item lookups
|
||||
INDEX idx_dataset_item dataset_item_id TYPE bloom_filter(0.001) GRANULARITY 1,
|
||||
) ENGINE = ReplicatedReplacingMergeTree(event_ts, is_deleted)
|
||||
ORDER BY (project_id, dataset_id, dataset_run_id, id);
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
ALTER TABLE observations ON CLUSTER default DROP INDEX IF EXISTS idx_res_metadata_value;
|
||||
ALTER TABLE observations ON CLUSTER default DROP INDEX IF EXISTS idx_res_metadata_key;
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
ALTER TABLE observations ON CLUSTER default ADD INDEX IF NOT EXISTS idx_res_metadata_key mapKeys(metadata) TYPE bloom_filter(0.01) GRANULARITY 1;
|
||||
ALTER TABLE observations ON CLUSTER default ADD INDEX IF NOT EXISTS idx_res_metadata_value mapValues(metadata) TYPE bloom_filter(0.01) GRANULARITY 1;
|
||||
ALTER TABLE observations ON CLUSTER default MATERIALIZE INDEX IF EXISTS idx_res_metadata_key;
|
||||
ALTER TABLE observations ON CLUSTER default MATERIALIZE INDEX IF EXISTS idx_res_metadata_value;
|
||||
@@ -0,0 +1 @@
|
||||
ALTER TABLE dataset_run_items_rmt ON CLUSTER default DROP INDEX IF EXISTS idx_trace_id;
|
||||
@@ -0,0 +1,2 @@
|
||||
ALTER TABLE dataset_run_items_rmt ON CLUSTER default ADD INDEX IF NOT EXISTS idx_trace_id trace_id TYPE bloom_filter(0.001) GRANULARITY 1;
|
||||
ALTER TABLE dataset_run_items_rmt ON CLUSTER default MATERIALIZE INDEX IF EXISTS idx_trace_id;
|
||||
@@ -0,0 +1 @@
|
||||
DROP TABLE dataset_run_items_rmt;
|
||||
@@ -0,0 +1,36 @@
|
||||
CREATE TABLE dataset_run_items_rmt (
|
||||
-- primary identifiers
|
||||
`id` String,
|
||||
`project_id` String,
|
||||
`dataset_run_id` String,
|
||||
`dataset_item_id` String,
|
||||
`dataset_id` String,
|
||||
`trace_id` String,
|
||||
`observation_id` Nullable(String),
|
||||
|
||||
-- error field
|
||||
`error` Nullable(String),
|
||||
|
||||
-- timestamps
|
||||
`created_at` DateTime64(3) DEFAULT now(),
|
||||
`updated_at` DateTime64(3) DEFAULT now(),
|
||||
|
||||
-- denormalized immutable dataset run fields
|
||||
`dataset_run_name` String,
|
||||
`dataset_run_description` Nullable(String),
|
||||
`dataset_run_metadata` Map(LowCardinality(String), String),
|
||||
`dataset_run_created_at` DateTime64(3),
|
||||
|
||||
-- denormalized dataset item fields (mutable, but snapshots are relevant)
|
||||
`dataset_item_input` Nullable(String) CODEC(ZSTD(3)), -- json
|
||||
`dataset_item_expected_output` Nullable(String) CODEC(ZSTD(3)), -- json
|
||||
`dataset_item_metadata` Map(LowCardinality(String), String),
|
||||
|
||||
-- clickhouse engine fields
|
||||
`event_ts` DateTime64(3),
|
||||
`is_deleted` UInt8,
|
||||
|
||||
-- For dataset item lookups
|
||||
INDEX idx_dataset_item dataset_item_id TYPE bloom_filter(0.001) GRANULARITY 1,
|
||||
) ENGINE = ReplacingMergeTree(event_ts, is_deleted)
|
||||
ORDER BY (project_id, dataset_id, dataset_run_id, id);
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
ALTER TABLE observations DROP INDEX IF EXISTS idx_res_metadata_value;
|
||||
ALTER TABLE observations DROP INDEX IF EXISTS idx_res_metadata_key;
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
ALTER TABLE observations ADD INDEX IF NOT EXISTS idx_res_metadata_key mapKeys(metadata) TYPE bloom_filter(0.01) GRANULARITY 1;
|
||||
ALTER TABLE observations ADD INDEX IF NOT EXISTS idx_res_metadata_value mapValues(metadata) TYPE bloom_filter(0.01) GRANULARITY 1;
|
||||
ALTER TABLE observations MATERIALIZE INDEX IF EXISTS idx_res_metadata_key;
|
||||
ALTER TABLE observations MATERIALIZE INDEX IF EXISTS idx_res_metadata_value;
|
||||
@@ -0,0 +1 @@
|
||||
ALTER TABLE dataset_run_items_rmt DROP INDEX IF EXISTS idx_trace_id;
|
||||
@@ -0,0 +1,2 @@
|
||||
ALTER TABLE dataset_run_items_rmt ADD INDEX IF NOT EXISTS idx_trace_id trace_id TYPE bloom_filter(0.001) GRANULARITY 1;
|
||||
ALTER TABLE dataset_run_items_rmt MATERIALIZE INDEX IF EXISTS idx_trace_id;
|
||||
@@ -61,7 +61,7 @@
|
||||
"@aws-sdk/lib-storage": "^3.675.0",
|
||||
"@aws-sdk/s3-request-presigner": "^3.679.0",
|
||||
"@azure/storage-blob": "^12.26.0",
|
||||
"@clickhouse/client": "^1.12.0",
|
||||
"@clickhouse/client": "^1.12.1",
|
||||
"@google-cloud/storage": "^7.15.2",
|
||||
"@langchain/anthropic": "^0.3.22",
|
||||
"@langchain/aws": "^0.1.11",
|
||||
@@ -73,10 +73,9 @@
|
||||
"@prisma/client": "^6.10.1",
|
||||
"@react-email/components": "^0.1.0",
|
||||
"@react-email/render": "^1.1.2",
|
||||
"@slack/oauth": "^2.6.0",
|
||||
"@slack/web-api": "^7.0.0",
|
||||
"@slack/oauth": "^3.0.3",
|
||||
"@slack/web-api": "^7.9.3",
|
||||
"@types/bcryptjs": "^2.4.6",
|
||||
"axios": "^1.8.2",
|
||||
"bcryptjs": "^2.4.3",
|
||||
"bullmq": "^5.34.10",
|
||||
"dd-trace": "^5.36.0",
|
||||
|
||||
@@ -22,6 +22,13 @@ export const LegacyPrismaObservationType = {
|
||||
SPAN: "SPAN",
|
||||
EVENT: "EVENT",
|
||||
GENERATION: "GENERATION",
|
||||
AGENT: "AGENT",
|
||||
TOOL: "TOOL",
|
||||
CHAIN: "CHAIN",
|
||||
RETRIEVER: "RETRIEVER",
|
||||
EVALUATOR: "EVALUATOR",
|
||||
EMBEDDING: "EMBEDDING",
|
||||
GUARDRAIL: "GUARDRAIL",
|
||||
} as const;
|
||||
export type LegacyPrismaObservationType =
|
||||
(typeof LegacyPrismaObservationType)[keyof typeof LegacyPrismaObservationType];
|
||||
@@ -150,6 +157,11 @@ export const ActionExecutionStatus = {
|
||||
} as const;
|
||||
export type ActionExecutionStatus =
|
||||
(typeof ActionExecutionStatus)[keyof typeof ActionExecutionStatus];
|
||||
export const SurveyName = {
|
||||
ORG_ONBOARDING: "org_onboarding",
|
||||
USER_ONBOARDING: "user_onboarding",
|
||||
} as const;
|
||||
export type SurveyName = (typeof SurveyName)[keyof typeof SurveyName];
|
||||
export type Account = {
|
||||
id: string;
|
||||
user_id: string;
|
||||
@@ -185,6 +197,14 @@ export type AnnotationQueue = {
|
||||
created_at: Generated<Timestamp>;
|
||||
updated_at: Generated<Timestamp>;
|
||||
};
|
||||
export type AnnotationQueueAssignment = {
|
||||
id: string;
|
||||
project_id: string;
|
||||
user_id: string;
|
||||
queue_id: string;
|
||||
created_at: Generated<Timestamp>;
|
||||
updated_at: Generated<Timestamp>;
|
||||
};
|
||||
export type AnnotationQueueItem = {
|
||||
id: string;
|
||||
queue_id: string;
|
||||
@@ -741,6 +761,15 @@ export type SsoConfig = {
|
||||
auth_provider: string;
|
||||
auth_config: unknown | null;
|
||||
};
|
||||
export type Survey = {
|
||||
id: string;
|
||||
created_at: Generated<Timestamp>;
|
||||
survey_name: SurveyName;
|
||||
response: unknown;
|
||||
user_id: string | null;
|
||||
user_email: string | null;
|
||||
org_id: string | null;
|
||||
};
|
||||
export type TableViewPreset = {
|
||||
id: string;
|
||||
created_at: Generated<Timestamp>;
|
||||
@@ -804,6 +833,7 @@ export type VerificationToken = {
|
||||
export type DB = {
|
||||
Account: Account;
|
||||
actions: Action;
|
||||
annotation_queue_assignments: AnnotationQueueAssignment;
|
||||
annotation_queue_items: AnnotationQueueItem;
|
||||
annotation_queues: AnnotationQueue;
|
||||
api_keys: ApiKey;
|
||||
@@ -849,6 +879,7 @@ export type DB = {
|
||||
Session: Session;
|
||||
slack_integrations: SlackIntegration;
|
||||
sso_configs: SsoConfig;
|
||||
surveys: Survey;
|
||||
table_view_presets: TableViewPreset;
|
||||
trace_media: TraceMedia;
|
||||
trace_sessions: TraceSession;
|
||||
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
-- CreateTable
|
||||
CREATE TABLE "annotation_queue_assignments" (
|
||||
"id" TEXT NOT NULL,
|
||||
"project_id" TEXT NOT NULL,
|
||||
"user_id" TEXT NOT NULL,
|
||||
"queue_id" TEXT NOT NULL,
|
||||
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
|
||||
CONSTRAINT "annotation_queue_assignments_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "annotation_queue_assignments_project_id_queue_id_key" ON "annotation_queue_assignments"("project_id", "queue_id", "user_id");
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "annotation_queue_assignments" ADD CONSTRAINT "annotation_queue_assignments_project_id_fkey" FOREIGN KEY ("project_id") REFERENCES "projects"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "annotation_queue_assignments" ADD CONSTRAINT "annotation_queue_assignments_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "users"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "annotation_queue_assignments" ADD CONSTRAINT "annotation_queue_assignments_queue_id_fkey" FOREIGN KEY ("queue_id") REFERENCES "annotation_queues"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
@@ -0,0 +1,24 @@
|
||||
-- CreateEnum
|
||||
CREATE TYPE "SurveyName" AS ENUM ('org_onboarding', 'user_onboarding');
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "surveys" (
|
||||
"id" TEXT NOT NULL,
|
||||
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"survey_name" "SurveyName" NOT NULL,
|
||||
"response" JSONB NOT NULL,
|
||||
"user_id" TEXT,
|
||||
"user_email" TEXT,
|
||||
"org_id" TEXT,
|
||||
|
||||
CONSTRAINT "surveys_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "surveys" ADD CONSTRAINT "surveys_org_id_fkey" FOREIGN KEY ("org_id") REFERENCES "organizations"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "surveys" ADD CONSTRAINT "surveys_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "users"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- RenameIndex
|
||||
ALTER INDEX "annotation_queue_assignments_project_id_queue_id_key" RENAME TO "annotation_queue_assignments_project_id_queue_id_user_id_key";
|
||||
+1
@@ -0,0 +1 @@
|
||||
DELETE FROM background_migrations WHERE id = '8d47f91b-3e5c-4a26-9f85-c12d6e4b9a3d';
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
INSERT INTO background_migrations (id, name, script, args)
|
||||
VALUES ('9f32e84c-7b1d-4f59-a803-d67ae5c9b2e8', '20250814_1001_migrate_dataset_run_items_rmt_pg_to_ch', 'migrateDatasetRunItemsFromPostgresToClickhouseRmt', '{}');
|
||||
@@ -65,29 +65,31 @@ model Session {
|
||||
}
|
||||
|
||||
model User {
|
||||
id String @id @default(cuid())
|
||||
name String?
|
||||
email String? @unique
|
||||
emailVerified DateTime? @map("email_verified")
|
||||
password String?
|
||||
image String?
|
||||
admin Boolean @default(false)
|
||||
accounts Account[]
|
||||
sessions Session[]
|
||||
organizationMemberships OrganizationMembership[]
|
||||
projectMemberships ProjectMembership[]
|
||||
invitations MembershipInvitation[]
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
updatedAt DateTime @default(now()) @updatedAt @map("updated_at")
|
||||
featureFlags String[] @default([]) @map("feature_flags")
|
||||
annotatedLockedItem AnnotationQueueItem[] @relation("LockedByUser")
|
||||
annotatedCompletedItem AnnotationQueueItem[] @relation("AnnotatorUser")
|
||||
dashboardWidgetsCreated DashboardWidget[] @relation("CreatedByUser")
|
||||
dashboardWidgetsUpdated DashboardWidget[] @relation("UpdatedByUser")
|
||||
dashboardCreated Dashboard[] @relation("CreatedByUser")
|
||||
dashboardUpdated Dashboard[] @relation("UpdatedByUser")
|
||||
tableViewPresetCreated TableViewPreset[] @relation("CreatedByUser")
|
||||
tableViewPresetUpdated TableViewPreset[] @relation("UpdatedByUser")
|
||||
id String @id @default(cuid())
|
||||
name String?
|
||||
email String? @unique
|
||||
emailVerified DateTime? @map("email_verified")
|
||||
password String?
|
||||
image String?
|
||||
admin Boolean @default(false)
|
||||
accounts Account[]
|
||||
sessions Session[]
|
||||
organizationMemberships OrganizationMembership[]
|
||||
projectMemberships ProjectMembership[]
|
||||
invitations MembershipInvitation[]
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
updatedAt DateTime @default(now()) @updatedAt @map("updated_at")
|
||||
featureFlags String[] @default([]) @map("feature_flags")
|
||||
annotatedLockedItem AnnotationQueueItem[] @relation("LockedByUser")
|
||||
annotatedCompletedItem AnnotationQueueItem[] @relation("AnnotatorUser")
|
||||
dashboardWidgetsCreated DashboardWidget[] @relation("CreatedByUser")
|
||||
dashboardWidgetsUpdated DashboardWidget[] @relation("UpdatedByUser")
|
||||
dashboardCreated Dashboard[] @relation("CreatedByUser")
|
||||
dashboardUpdated Dashboard[] @relation("UpdatedByUser")
|
||||
tableViewPresetCreated TableViewPreset[] @relation("CreatedByUser")
|
||||
tableViewPresetUpdated TableViewPreset[] @relation("UpdatedByUser")
|
||||
annotationQueueAssignment AnnotationQueueAssignment[]
|
||||
surveys Survey[]
|
||||
|
||||
@@map("users")
|
||||
}
|
||||
@@ -112,59 +114,61 @@ model Organization {
|
||||
projects Project[]
|
||||
MembershipInvitation MembershipInvitation[]
|
||||
ApiKey ApiKey[]
|
||||
surveys Survey[]
|
||||
|
||||
@@map("organizations")
|
||||
}
|
||||
|
||||
model Project {
|
||||
id String @id @default(cuid())
|
||||
orgId String @map("org_id")
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
updatedAt DateTime @default(now()) @updatedAt @map("updated_at")
|
||||
deletedAt DateTime? @map("deleted_at")
|
||||
name String
|
||||
retentionDays Int? @map("retention_days")
|
||||
metadata Json?
|
||||
projectMembers ProjectMembership[]
|
||||
organization Organization @relation(fields: [orgId], references: [id], onUpdate: Cascade, onDelete: Cascade)
|
||||
apiKeys ApiKey[]
|
||||
dataset Dataset[]
|
||||
invitations MembershipInvitation[]
|
||||
sessions TraceSession[]
|
||||
Prompt Prompt[]
|
||||
Model Model[]
|
||||
EvalTemplate EvalTemplate[]
|
||||
JobConfiguration JobConfiguration[]
|
||||
JobExecution JobExecution[]
|
||||
LlmApiKeys LlmApiKeys[]
|
||||
PosthogIntegration PosthogIntegration[]
|
||||
BlobStorageIntegration BlobStorageIntegration[]
|
||||
scoreConfig ScoreConfig[]
|
||||
BatchExport BatchExport[]
|
||||
comment Comment[]
|
||||
annotationQueue AnnotationQueue[]
|
||||
annotationQueueItem AnnotationQueueItem[]
|
||||
TraceMedia TraceMedia[]
|
||||
Media Media[]
|
||||
ObservationMedia ObservationMedia[]
|
||||
LegacyTrace LegacyPrismaTrace[]
|
||||
LegacyObservation LegacyPrismaObservation[]
|
||||
LegacyScore LegacyPrismaScore[]
|
||||
PromptDependency PromptDependency[]
|
||||
LlmSchema LlmSchema[]
|
||||
LlmTool LlmTool[]
|
||||
PromptProtectedLabels PromptProtectedLabels[]
|
||||
Dashboard Dashboard[]
|
||||
DashboardWidget DashboardWidget[]
|
||||
TableViewPreset TableViewPreset[]
|
||||
actions Action[]
|
||||
triggers Trigger[]
|
||||
automationExecutions AutomationExecution[]
|
||||
Automation Automation[]
|
||||
DefaultLlmModel DefaultLlmModel[]
|
||||
Price Price[]
|
||||
SlackIntegration SlackIntegration?
|
||||
PendingDeletion PendingDeletion[]
|
||||
id String @id @default(cuid())
|
||||
orgId String @map("org_id")
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
updatedAt DateTime @default(now()) @updatedAt @map("updated_at")
|
||||
deletedAt DateTime? @map("deleted_at")
|
||||
name String
|
||||
retentionDays Int? @map("retention_days")
|
||||
metadata Json?
|
||||
projectMembers ProjectMembership[]
|
||||
organization Organization @relation(fields: [orgId], references: [id], onUpdate: Cascade, onDelete: Cascade)
|
||||
apiKeys ApiKey[]
|
||||
dataset Dataset[]
|
||||
invitations MembershipInvitation[]
|
||||
sessions TraceSession[]
|
||||
Prompt Prompt[]
|
||||
Model Model[]
|
||||
EvalTemplate EvalTemplate[]
|
||||
JobConfiguration JobConfiguration[]
|
||||
JobExecution JobExecution[]
|
||||
LlmApiKeys LlmApiKeys[]
|
||||
PosthogIntegration PosthogIntegration[]
|
||||
BlobStorageIntegration BlobStorageIntegration[]
|
||||
scoreConfig ScoreConfig[]
|
||||
BatchExport BatchExport[]
|
||||
comment Comment[]
|
||||
annotationQueue AnnotationQueue[]
|
||||
annotationQueueItem AnnotationQueueItem[]
|
||||
TraceMedia TraceMedia[]
|
||||
Media Media[]
|
||||
ObservationMedia ObservationMedia[]
|
||||
LegacyTrace LegacyPrismaTrace[]
|
||||
LegacyObservation LegacyPrismaObservation[]
|
||||
LegacyScore LegacyPrismaScore[]
|
||||
PromptDependency PromptDependency[]
|
||||
LlmSchema LlmSchema[]
|
||||
LlmTool LlmTool[]
|
||||
PromptProtectedLabels PromptProtectedLabels[]
|
||||
Dashboard Dashboard[]
|
||||
DashboardWidget DashboardWidget[]
|
||||
TableViewPreset TableViewPreset[]
|
||||
actions Action[]
|
||||
triggers Trigger[]
|
||||
automationExecutions AutomationExecution[]
|
||||
Automation Automation[]
|
||||
DefaultLlmModel DefaultLlmModel[]
|
||||
Price Price[]
|
||||
SlackIntegration SlackIntegration?
|
||||
PendingDeletion PendingDeletion[]
|
||||
AnnotationQueueAssignment AnnotationQueueAssignment[]
|
||||
|
||||
@@index([orgId])
|
||||
@@map("projects")
|
||||
@@ -364,7 +368,6 @@ model LegacyPrismaObservation {
|
||||
version String?
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
updatedAt DateTime @default(now()) @updatedAt @map("updated_at")
|
||||
// GENERATION ONLY
|
||||
model String? // user-provided model attribute
|
||||
internalModel String? @map("internal_model") // matched model.name that is matched at ingestion time, to be deprecated
|
||||
internalModelId String? @map("internal_model_id") // matched model.id that is matched at ingestion time
|
||||
@@ -405,6 +408,13 @@ enum LegacyPrismaObservationType {
|
||||
SPAN
|
||||
EVENT
|
||||
GENERATION
|
||||
AGENT
|
||||
TOOL
|
||||
CHAIN
|
||||
RETRIEVER
|
||||
EVALUATOR
|
||||
EMBEDDING
|
||||
GUARDRAIL
|
||||
|
||||
@@map("ObservationType")
|
||||
}
|
||||
@@ -491,15 +501,16 @@ enum ScoreDataType {
|
||||
}
|
||||
|
||||
model AnnotationQueue {
|
||||
id String @id @default(cuid())
|
||||
name String
|
||||
description String?
|
||||
scoreConfigIds String[] @default([]) @map("score_config_ids")
|
||||
projectId String @map("project_id")
|
||||
project Project @relation(fields: [projectId], references: [id], onDelete: Cascade)
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
updatedAt DateTime @default(now()) @updatedAt @map("updated_at")
|
||||
annotationQueueItem AnnotationQueueItem[]
|
||||
id String @id @default(cuid())
|
||||
name String
|
||||
description String?
|
||||
scoreConfigIds String[] @default([]) @map("score_config_ids")
|
||||
projectId String @map("project_id")
|
||||
project Project @relation(fields: [projectId], references: [id], onDelete: Cascade)
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
updatedAt DateTime @default(now()) @updatedAt @map("updated_at")
|
||||
annotationQueueItem AnnotationQueueItem[]
|
||||
annotationQueueAssignment AnnotationQueueAssignment[]
|
||||
|
||||
@@unique([projectId, name])
|
||||
@@index([id, projectId])
|
||||
@@ -544,6 +555,21 @@ enum AnnotationQueueObjectType {
|
||||
SESSION
|
||||
}
|
||||
|
||||
model AnnotationQueueAssignment {
|
||||
id String @id @default(cuid())
|
||||
projectId String @map("project_id")
|
||||
project Project @relation(fields: [projectId], references: [id], onDelete: Cascade)
|
||||
userId String @map("user_id")
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
queueId String @map("queue_id")
|
||||
queue AnnotationQueue @relation(fields: [queueId], references: [id], onDelete: Cascade)
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
updatedAt DateTime @default(now()) @updatedAt @map("updated_at")
|
||||
|
||||
@@unique([projectId, queueId, userId])
|
||||
@@map("annotation_queue_assignments")
|
||||
}
|
||||
|
||||
model CronJobs {
|
||||
name String @id
|
||||
lastRun DateTime? @map("last_run")
|
||||
@@ -1379,3 +1405,24 @@ model PendingDeletion {
|
||||
@@index([objectId, object])
|
||||
@@map("pending_deletions")
|
||||
}
|
||||
|
||||
model Survey {
|
||||
id String @id @default(cuid())
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
surveyName SurveyName @map("survey_name")
|
||||
response Json
|
||||
userId String? @map("user_id")
|
||||
userEmail String? @map("user_email")
|
||||
orgId String? @map("org_id")
|
||||
org Organization? @relation(fields: [orgId], references: [id], onDelete: Cascade)
|
||||
user User? @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@map("surveys")
|
||||
}
|
||||
|
||||
enum SurveyName {
|
||||
ORG_ONBOARDING @map("org_onboarding")
|
||||
USER_ONBOARDING @map("user_onboarding")
|
||||
|
||||
@@map("SurveyName")
|
||||
}
|
||||
|
||||
@@ -95,3 +95,57 @@ export const REALISTIC_METADATA_EXAMPLES = [
|
||||
},
|
||||
{ file_type: "JSON", validation: "passed", schema_version: "v1.2" },
|
||||
];
|
||||
|
||||
export const REALISTIC_AGENT_NAMES = [
|
||||
"AI-Coordinator",
|
||||
"TaskManager",
|
||||
"WorkflowOrchestrator",
|
||||
"PlanningAgent",
|
||||
"MultiStepAgent",
|
||||
"SmartCoordinator",
|
||||
];
|
||||
|
||||
export const REALISTIC_TOOL_NAMES = [
|
||||
"WebSearchTool",
|
||||
"CalculatorTool",
|
||||
"WeatherForecastTool",
|
||||
"EmailSenderTool",
|
||||
];
|
||||
|
||||
export const REALISTIC_CHAIN_NAMES = [
|
||||
"DataTransformationChain",
|
||||
"ProcessingPipeline",
|
||||
"TransformationChain",
|
||||
"MultiStepProcess",
|
||||
];
|
||||
|
||||
export const REALISTIC_RETRIEVER_NAMES = [
|
||||
"DocumentRetriever",
|
||||
"SemanticSearch",
|
||||
"InformationRetriever",
|
||||
"VectorSearch",
|
||||
"MemoryRetriever",
|
||||
];
|
||||
|
||||
export const REALISTIC_EVALUATOR_NAMES = [
|
||||
"QualityEvaluator",
|
||||
"RelevanceScorer",
|
||||
"AccuracyChecker",
|
||||
"ResponseEvaluator",
|
||||
"ContentScorer",
|
||||
];
|
||||
|
||||
export const REALISTIC_EMBEDDING_NAMES = [
|
||||
"TextEmbedding",
|
||||
"DocumentEncoder",
|
||||
"SemanticEncoder",
|
||||
"VectorEmbedding",
|
||||
];
|
||||
|
||||
export const REALISTIC_GUARDRAIL_NAMES = [
|
||||
"SafetyChecker",
|
||||
"ContentModerator",
|
||||
"ToxicityFilter",
|
||||
"JailbreakDetector",
|
||||
"PolicyEnforcer",
|
||||
];
|
||||
|
||||
@@ -4,6 +4,13 @@ import {
|
||||
REALISTIC_SPAN_NAMES,
|
||||
REALISTIC_GENERATION_NAMES,
|
||||
REALISTIC_MODELS,
|
||||
REALISTIC_AGENT_NAMES,
|
||||
REALISTIC_TOOL_NAMES,
|
||||
REALISTIC_CHAIN_NAMES,
|
||||
REALISTIC_RETRIEVER_NAMES,
|
||||
REALISTIC_EVALUATOR_NAMES,
|
||||
REALISTIC_EMBEDDING_NAMES,
|
||||
REALISTIC_GUARDRAIL_NAMES,
|
||||
} from "./clickhouse-seed-constants";
|
||||
import {
|
||||
generateDatasetItemId,
|
||||
@@ -365,8 +372,56 @@ export class DataGenerator {
|
||||
const observations: ObservationRecordInsertType[] = [];
|
||||
|
||||
traces.forEach((trace, traceIndex) => {
|
||||
if (this.randomBoolean(0.1)) {
|
||||
const { observations: workflowObservations } =
|
||||
this.generateComprehensiveAIWorkflowTrace(trace.id, trace.project_id);
|
||||
observations.push(...workflowObservations);
|
||||
return;
|
||||
}
|
||||
|
||||
for (let i = 0; i < observationsPerTrace; i++) {
|
||||
const obsType = this.randomElement(["GENERATION", "SPAN", "EVENT"]);
|
||||
const obsType = this.randomBoolean(0.8) // More "traditional" types, are more common in app
|
||||
? this.randomElement(["GENERATION", "SPAN", "EVENT"])
|
||||
: this.randomElement([
|
||||
"AGENT",
|
||||
"TOOL",
|
||||
"CHAIN",
|
||||
"RETRIEVER",
|
||||
"EVALUATOR",
|
||||
"EMBEDDING",
|
||||
"GUARDRAIL",
|
||||
]);
|
||||
|
||||
let observationName: string;
|
||||
switch (obsType) {
|
||||
case "AGENT":
|
||||
observationName = this.randomElement(REALISTIC_AGENT_NAMES);
|
||||
break;
|
||||
case "TOOL":
|
||||
observationName = this.randomElement(REALISTIC_TOOL_NAMES);
|
||||
break;
|
||||
case "CHAIN":
|
||||
observationName = this.randomElement(REALISTIC_CHAIN_NAMES);
|
||||
break;
|
||||
case "RETRIEVER":
|
||||
observationName = this.randomElement(REALISTIC_RETRIEVER_NAMES);
|
||||
break;
|
||||
case "EVALUATOR":
|
||||
observationName = this.randomElement(REALISTIC_EVALUATOR_NAMES);
|
||||
break;
|
||||
case "EMBEDDING":
|
||||
observationName = this.randomElement(REALISTIC_EMBEDDING_NAMES);
|
||||
break;
|
||||
case "GUARDRAIL":
|
||||
observationName = this.randomElement(REALISTIC_GUARDRAIL_NAMES);
|
||||
break;
|
||||
case "GENERATION":
|
||||
observationName = this.randomElement(REALISTIC_GENERATION_NAMES);
|
||||
break;
|
||||
default:
|
||||
observationName = this.randomElement(REALISTIC_SPAN_NAMES);
|
||||
break;
|
||||
}
|
||||
|
||||
const observation: ObservationRecordInsertType = createObservation({
|
||||
id: `obs-synthetic-${traceIndex}-${i}`,
|
||||
@@ -375,28 +430,28 @@ export class DataGenerator {
|
||||
parent_observation_id:
|
||||
i > 0 ? `obs-synthetic-${traceIndex}-${i - 1}` : undefined,
|
||||
type: obsType as any,
|
||||
name:
|
||||
obsType === "GENERATION"
|
||||
? this.randomElement(REALISTIC_GENERATION_NAMES)
|
||||
: this.randomElement(REALISTIC_SPAN_NAMES),
|
||||
name: observationName,
|
||||
input:
|
||||
obsType === "GENERATION"
|
||||
obsType === "GENERATION" || obsType === "EMBEDDING"
|
||||
? this.generateObservationInput()
|
||||
: undefined,
|
||||
output:
|
||||
obsType === "GENERATION"
|
||||
obsType === "GENERATION" ||
|
||||
obsType === "RETRIEVER" ||
|
||||
obsType === "EVALUATOR" ||
|
||||
obsType === "GUARDRAIL"
|
||||
? this.generateObservationOutput()
|
||||
: undefined,
|
||||
provided_model_name:
|
||||
obsType === "GENERATION"
|
||||
obsType === "GENERATION" || obsType === "EMBEDDING"
|
||||
? this.randomElement(REALISTIC_MODELS)
|
||||
: undefined,
|
||||
model_parameters:
|
||||
obsType === "GENERATION"
|
||||
obsType === "GENERATION" || obsType === "EMBEDDING"
|
||||
? JSON.stringify({ temperature: 0.7 })
|
||||
: undefined,
|
||||
usage_details:
|
||||
obsType === "GENERATION"
|
||||
obsType === "GENERATION" || obsType === "EMBEDDING"
|
||||
? {
|
||||
input: this.randomInt(20, 200),
|
||||
output: this.randomInt(10, 100),
|
||||
@@ -404,7 +459,7 @@ export class DataGenerator {
|
||||
}
|
||||
: undefined,
|
||||
provided_usage_details:
|
||||
obsType === "GENERATION"
|
||||
obsType === "GENERATION" || obsType === "EMBEDDING"
|
||||
? {
|
||||
input: this.randomInt(20, 200),
|
||||
output: this.randomInt(10, 100),
|
||||
@@ -412,7 +467,7 @@ export class DataGenerator {
|
||||
}
|
||||
: undefined,
|
||||
cost_details:
|
||||
obsType === "GENERATION"
|
||||
obsType === "GENERATION" || obsType === "EMBEDDING"
|
||||
? {
|
||||
input: this.randomInt(1, 10) / 100000,
|
||||
output: this.randomInt(1, 20) / 100000,
|
||||
@@ -420,7 +475,7 @@ export class DataGenerator {
|
||||
}
|
||||
: undefined,
|
||||
provided_cost_details:
|
||||
obsType === "GENERATION"
|
||||
obsType === "GENERATION" || obsType === "EMBEDDING"
|
||||
? {
|
||||
input: this.randomInt(1, 10) / 100000,
|
||||
output: this.randomInt(1, 20) / 100000,
|
||||
@@ -500,6 +555,252 @@ export class DataGenerator {
|
||||
return scores;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a workflow trace with all possible observation types.
|
||||
*/
|
||||
generateComprehensiveAIWorkflowTrace(
|
||||
traceId: string,
|
||||
projectId: string,
|
||||
): {
|
||||
trace: TraceRecordInsertType;
|
||||
observations: ObservationRecordInsertType[];
|
||||
} {
|
||||
// Create the main trace
|
||||
const trace = createTrace({
|
||||
id: traceId,
|
||||
project_id: projectId,
|
||||
name: "AI-Agent-Workflow",
|
||||
input:
|
||||
"Analyze and summarize the latest research papers on quantum computing",
|
||||
output:
|
||||
"Here is a comprehensive summary of quantum computing research trends with key insights and recommendations.",
|
||||
user_id: this.randomBoolean(0.3)
|
||||
? `user_${this.randomInt(1, 1000)}`
|
||||
: null,
|
||||
session_id: this.randomBoolean(0.3)
|
||||
? `session_${this.randomInt(1, 100)}`
|
||||
: undefined,
|
||||
environment: "default",
|
||||
metadata: { workflowType: "comprehensive-ai", purpose: "demonstration" },
|
||||
tags: ["ai-agent", "multi-step", "comprehensive"],
|
||||
public: true,
|
||||
bookmarked: this.randomBoolean(0.2),
|
||||
});
|
||||
|
||||
const observations: ObservationRecordInsertType[] = [];
|
||||
const baseTime = Date.now();
|
||||
|
||||
// 1. AGENT - Main coordinator
|
||||
observations.push(
|
||||
createObservation({
|
||||
id: `${traceId}-agent`,
|
||||
trace_id: trace.id,
|
||||
project_id: projectId,
|
||||
type: "AGENT",
|
||||
name: this.randomElement(REALISTIC_AGENT_NAMES),
|
||||
input: "Plan and coordinate the research analysis workflow",
|
||||
output:
|
||||
"Workflow planned: retrieve documents → create embeddings → analyze → evaluate → check safety",
|
||||
start_time: baseTime,
|
||||
end_time: baseTime + 500,
|
||||
level: "DEFAULT",
|
||||
environment: trace.environment,
|
||||
metadata: { role: "coordinator", step: "1" },
|
||||
}),
|
||||
);
|
||||
|
||||
// 2. RETRIEVER - Document retrieval
|
||||
observations.push(
|
||||
createObservation({
|
||||
id: `${traceId}-retriever`,
|
||||
trace_id: trace.id,
|
||||
project_id: projectId,
|
||||
parent_observation_id: `${traceId}-agent`,
|
||||
type: "RETRIEVER",
|
||||
name: this.randomElement(REALISTIC_RETRIEVER_NAMES),
|
||||
input: "query: quantum computing research papers 2024",
|
||||
output: "Retrieved 15 relevant research papers from arXiv and IEEE",
|
||||
start_time: baseTime + 500,
|
||||
end_time: baseTime + 2000,
|
||||
level: "DEFAULT",
|
||||
environment: trace.environment,
|
||||
metadata: { documentsFound: "15", sources: "arXiv,IEEE" },
|
||||
}),
|
||||
);
|
||||
|
||||
// 3. EMBEDDING - Create document embeddings
|
||||
observations.push(
|
||||
createObservation({
|
||||
id: `${traceId}-embedding`,
|
||||
trace_id: trace.id,
|
||||
project_id: projectId,
|
||||
parent_observation_id: `${traceId}-retriever`,
|
||||
type: "EMBEDDING",
|
||||
name: this.randomElement(REALISTIC_EMBEDDING_NAMES),
|
||||
input: "15 research paper abstracts and titles",
|
||||
output: "Generated 1536-dimensional embeddings for semantic similarity",
|
||||
start_time: baseTime + 2000,
|
||||
end_time: baseTime + 3500,
|
||||
level: "DEFAULT",
|
||||
environment: trace.environment,
|
||||
metadata: {
|
||||
embeddingModel: "text-embedding-ada-002",
|
||||
dimensions: "1536",
|
||||
},
|
||||
usage_details: {
|
||||
input: this.randomInt(2000, 4000),
|
||||
total: this.randomInt(2000, 4000),
|
||||
},
|
||||
provided_usage_details: {
|
||||
input: this.randomInt(2000, 4000),
|
||||
total: this.randomInt(2000, 4000),
|
||||
},
|
||||
cost_details: {
|
||||
input: this.randomInt(5, 15) / 100000,
|
||||
total: this.randomInt(5, 15) / 100000,
|
||||
},
|
||||
provided_cost_details: {
|
||||
input: this.randomInt(5, 15) / 100000,
|
||||
total: this.randomInt(5, 15) / 100000,
|
||||
},
|
||||
}),
|
||||
);
|
||||
|
||||
// 4. CHAIN - Processing pipeline
|
||||
observations.push(
|
||||
createObservation({
|
||||
id: `${traceId}-chain`,
|
||||
trace_id: trace.id,
|
||||
project_id: projectId,
|
||||
parent_observation_id: `${traceId}-embedding`,
|
||||
type: "CHAIN",
|
||||
name: this.randomElement(REALISTIC_CHAIN_NAMES),
|
||||
input: "Research papers with embeddings",
|
||||
output:
|
||||
"Processed and analyzed 15 papers through multi-step analysis chain",
|
||||
start_time: baseTime + 3500,
|
||||
end_time: baseTime + 8000,
|
||||
level: "DEFAULT",
|
||||
environment: trace.environment,
|
||||
metadata: { steps: "4", processed: "15" },
|
||||
}),
|
||||
);
|
||||
|
||||
// 5. TOOL - External API call for additional context
|
||||
observations.push(
|
||||
createObservation({
|
||||
id: `${traceId}-tool`,
|
||||
trace_id: trace.id,
|
||||
project_id: projectId,
|
||||
parent_observation_id: `${traceId}-chain`,
|
||||
type: "TOOL",
|
||||
name: this.randomElement(REALISTIC_TOOL_NAMES),
|
||||
input: "Search for quantum computing market trends",
|
||||
output:
|
||||
"Market data: $1.2B industry, 25% YoY growth, key players identified",
|
||||
start_time: baseTime + 8000,
|
||||
end_time: baseTime + 10000,
|
||||
level: "DEFAULT",
|
||||
environment: trace.environment,
|
||||
metadata: { toolType: "api-call", endpoint: "market-research" },
|
||||
}),
|
||||
);
|
||||
|
||||
// 6. GENERATION - Final summary generation
|
||||
observations.push(
|
||||
createObservation({
|
||||
id: `${traceId}-generation`,
|
||||
trace_id: trace.id,
|
||||
project_id: projectId,
|
||||
parent_observation_id: `${traceId}-tool`,
|
||||
type: "GENERATION",
|
||||
name: this.randomElement(REALISTIC_GENERATION_NAMES),
|
||||
input:
|
||||
"Synthesize research analysis and market data into comprehensive summary",
|
||||
output:
|
||||
"Generated comprehensive 2000-word analysis of quantum computing research trends",
|
||||
provided_model_name: this.randomElement(REALISTIC_MODELS),
|
||||
model_parameters: JSON.stringify({
|
||||
temperature: 0.3,
|
||||
max_tokens: 2000,
|
||||
}),
|
||||
start_time: baseTime + 10000,
|
||||
end_time: baseTime + 15000,
|
||||
level: "DEFAULT",
|
||||
environment: trace.environment,
|
||||
usage_details: {
|
||||
input: this.randomInt(1500, 2500),
|
||||
output: this.randomInt(1800, 2200),
|
||||
total: this.randomInt(3300, 4700),
|
||||
},
|
||||
provided_usage_details: {
|
||||
input: this.randomInt(1500, 2500),
|
||||
output: this.randomInt(1800, 2200),
|
||||
total: this.randomInt(3300, 4700),
|
||||
},
|
||||
cost_details: {
|
||||
input: this.randomInt(15, 25) / 100000,
|
||||
output: this.randomInt(35, 45) / 100000,
|
||||
total: this.randomInt(50, 70) / 100000,
|
||||
},
|
||||
provided_cost_details: {
|
||||
input: this.randomInt(15, 25) / 100000,
|
||||
output: this.randomInt(35, 45) / 100000,
|
||||
total: this.randomInt(50, 70) / 100000,
|
||||
},
|
||||
}),
|
||||
);
|
||||
|
||||
// 7. EVALUATOR - Quality evaluation
|
||||
observations.push(
|
||||
createObservation({
|
||||
id: `${traceId}-evaluator`,
|
||||
trace_id: trace.id,
|
||||
project_id: projectId,
|
||||
parent_observation_id: `${traceId}-generation`,
|
||||
type: "EVALUATOR",
|
||||
name: this.randomElement(REALISTIC_EVALUATOR_NAMES),
|
||||
input: "Evaluate summary quality, accuracy, and completeness",
|
||||
output: "Quality score: 8.7/10, High accuracy, Comprehensive coverage",
|
||||
start_time: baseTime + 15000,
|
||||
end_time: baseTime + 16500,
|
||||
level: "DEFAULT",
|
||||
environment: trace.environment,
|
||||
metadata: {
|
||||
qualityScore: "8.7",
|
||||
accuracy: "high",
|
||||
completeness: "comprehensive",
|
||||
},
|
||||
}),
|
||||
);
|
||||
|
||||
// 8. GUARDRAIL - Safety and compliance check
|
||||
observations.push(
|
||||
createObservation({
|
||||
id: `${traceId}-guardrail`,
|
||||
trace_id: trace.id,
|
||||
project_id: projectId,
|
||||
parent_observation_id: `${traceId}-evaluator`,
|
||||
type: "GUARDRAIL",
|
||||
name: this.randomElement(REALISTIC_GUARDRAIL_NAMES),
|
||||
input: "Check content for safety, bias, and compliance issues",
|
||||
output:
|
||||
"✓ Content approved: No safety issues, Low bias detected, Compliant",
|
||||
start_time: baseTime + 16500,
|
||||
end_time: baseTime + 17000,
|
||||
level: "DEFAULT",
|
||||
environment: trace.environment,
|
||||
metadata: {
|
||||
safetyCheck: "passed",
|
||||
biasLevel: "low",
|
||||
compliance: "approved",
|
||||
},
|
||||
}),
|
||||
);
|
||||
|
||||
return { trace, observations };
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates evaluation traces for testing evaluator configurations.
|
||||
* Use for: Evaluation testing, score validation, evaluator development.
|
||||
|
||||
@@ -6,8 +6,27 @@ export const ObservationType = {
|
||||
SPAN: "SPAN",
|
||||
EVENT: "EVENT",
|
||||
GENERATION: "GENERATION",
|
||||
AGENT: "AGENT",
|
||||
TOOL: "TOOL",
|
||||
CHAIN: "CHAIN",
|
||||
RETRIEVER: "RETRIEVER",
|
||||
EVALUATOR: "EVALUATOR",
|
||||
EMBEDDING: "EMBEDDING",
|
||||
GUARDRAIL: "GUARDRAIL",
|
||||
} as const;
|
||||
export const ObservationTypeDomain = z.enum(["SPAN", "EVENT", "GENERATION"]);
|
||||
|
||||
export const ObservationTypeDomain = z.enum([
|
||||
"SPAN",
|
||||
"EVENT",
|
||||
"GENERATION",
|
||||
"AGENT",
|
||||
"TOOL",
|
||||
"CHAIN",
|
||||
"RETRIEVER",
|
||||
"EVALUATOR",
|
||||
"EMBEDDING",
|
||||
"GUARDRAIL",
|
||||
]);
|
||||
export type ObservationType = z.infer<typeof ObservationTypeDomain>;
|
||||
|
||||
export const ObservationLevel = {
|
||||
@@ -74,3 +93,29 @@ export const ObservationSchema = z.object({
|
||||
});
|
||||
|
||||
export type Observation = z.infer<typeof ObservationSchema>;
|
||||
|
||||
/**
|
||||
* Returns true if an observation type is generation-like, meaning it could include LLM calls
|
||||
* and potentially has similar input/output fields.
|
||||
*/
|
||||
export const GenerationLikeObservationTypes = [
|
||||
ObservationType.GENERATION,
|
||||
ObservationType.AGENT,
|
||||
ObservationType.TOOL,
|
||||
ObservationType.CHAIN,
|
||||
ObservationType.RETRIEVER,
|
||||
ObservationType.EVALUATOR,
|
||||
ObservationType.EMBEDDING,
|
||||
ObservationType.GUARDRAIL,
|
||||
] as const;
|
||||
|
||||
export const isGenerationLike = (observationType: ObservationType): boolean => {
|
||||
return GenerationLikeObservationTypes.includes(observationType as any);
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns all generation-like observation types for use in filters and queries.
|
||||
*/
|
||||
export const getGenerationLikeTypes = (): ObservationType[] => {
|
||||
return [...GenerationLikeObservationTypes];
|
||||
};
|
||||
|
||||
@@ -50,6 +50,10 @@ const EnvSchema = z.object({
|
||||
.nonnegative()
|
||||
.default(15_000),
|
||||
LANGFUSE_INGESTION_QUEUE_SHARD_COUNT: z.coerce.number().positive().default(1),
|
||||
LANGFUSE_TRACE_UPSERT_QUEUE_SHARD_COUNT: z.coerce
|
||||
.number()
|
||||
.positive()
|
||||
.default(1),
|
||||
LANGFUSE_TRACE_DELETE_DELAY_MS: z.coerce
|
||||
.number()
|
||||
.nonnegative()
|
||||
@@ -148,9 +152,18 @@ const EnvSchema = z.object({
|
||||
LANGFUSE_EXPERIMENT_RETURN_NEW_RESULT: z
|
||||
.enum(["true", "false"])
|
||||
.default("false"),
|
||||
LANGFUSE_EXPERIMENT_RETURN_NEW_RESULT_SHORT_TERM: z
|
||||
.enum(["true", "false"])
|
||||
.default("false"),
|
||||
LANGFUSE_EXPERIMENT_INSERT_INTO_AGGREGATING_MERGE_TREES: z
|
||||
.enum(["true", "false"])
|
||||
.default("false"),
|
||||
LANGFUSE_EXPERIMENT_WHITELISTED_AMT_TABLES: z
|
||||
.string()
|
||||
.optional()
|
||||
.transform((s) =>
|
||||
s ? s.split(",").map((s) => s.toLowerCase().trim()) : [],
|
||||
),
|
||||
LANGFUSE_INGESTION_PROCESSING_SAMPLED_PROJECTS: z
|
||||
.string()
|
||||
.optional()
|
||||
@@ -183,10 +196,18 @@ const EnvSchema = z.object({
|
||||
return new Map<string, number>();
|
||||
}
|
||||
}),
|
||||
|
||||
SLACK_CLIENT_ID: z.string().optional(),
|
||||
SLACK_CLIENT_SECRET: z.string().optional(),
|
||||
SLACK_STATE_SECRET: z.string().optional(),
|
||||
SLACK_FETCH_LIMIT: z
|
||||
.number()
|
||||
.positive()
|
||||
.optional()
|
||||
.default(1_000)
|
||||
.describe(
|
||||
"How many records should be fetched from Slack, before we give up",
|
||||
),
|
||||
HTTPS_PROXY: z.string().optional(),
|
||||
|
||||
LANGFUSE_SERVER_SIDE_IO_CHAR_LIMIT: z.coerce
|
||||
.number()
|
||||
|
||||
@@ -91,4 +91,11 @@ export const CreateQueueData = z.object({
|
||||
}),
|
||||
});
|
||||
|
||||
export const CreateQueueWithAssignmentsData = CreateQueueData.extend({
|
||||
newAssignmentUserIds: z.array(z.string()),
|
||||
});
|
||||
|
||||
export type CreateQueue = z.infer<typeof CreateQueueData>;
|
||||
export type CreateQueueWithAssignments = z.infer<
|
||||
typeof CreateQueueWithAssignmentsData
|
||||
>;
|
||||
|
||||
@@ -5,6 +5,13 @@ export const langfuseObjects = [
|
||||
"span",
|
||||
"generation",
|
||||
"event",
|
||||
"agent",
|
||||
"tool",
|
||||
"chain",
|
||||
"retriever",
|
||||
"evaluator",
|
||||
"embedding",
|
||||
"guardrail",
|
||||
"dataset_item",
|
||||
] as const;
|
||||
|
||||
@@ -51,6 +58,56 @@ const observationCols = [
|
||||
];
|
||||
|
||||
export const availableTraceEvalVariables = [
|
||||
{
|
||||
id: "agent",
|
||||
display: "Agent",
|
||||
availableColumns: observationCols,
|
||||
},
|
||||
{
|
||||
id: "chain",
|
||||
display: "Chain",
|
||||
availableColumns: observationCols,
|
||||
},
|
||||
{
|
||||
id: "embedding",
|
||||
display: "Embedding",
|
||||
availableColumns: observationCols,
|
||||
},
|
||||
{
|
||||
id: "evaluator",
|
||||
display: "Evaluator",
|
||||
availableColumns: observationCols,
|
||||
},
|
||||
{
|
||||
id: "event",
|
||||
display: "Event",
|
||||
availableColumns: observationCols,
|
||||
},
|
||||
{
|
||||
id: "generation",
|
||||
display: "Generation",
|
||||
availableColumns: observationCols,
|
||||
},
|
||||
{
|
||||
id: "guardrail",
|
||||
display: "Guardrail",
|
||||
availableColumns: observationCols,
|
||||
},
|
||||
{
|
||||
id: "retriever",
|
||||
display: "Retriever",
|
||||
availableColumns: observationCols,
|
||||
},
|
||||
{
|
||||
id: "span",
|
||||
display: "Span",
|
||||
availableColumns: observationCols,
|
||||
},
|
||||
{
|
||||
id: "tool",
|
||||
display: "Tool",
|
||||
availableColumns: observationCols,
|
||||
},
|
||||
{
|
||||
id: "trace",
|
||||
display: "Trace",
|
||||
@@ -65,21 +122,6 @@ export const availableTraceEvalVariables = [
|
||||
{ name: "Output", id: "output", internal: 't."output"' },
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "span",
|
||||
display: "Span",
|
||||
availableColumns: observationCols,
|
||||
},
|
||||
{
|
||||
id: "generation",
|
||||
display: "Generation",
|
||||
availableColumns: observationCols,
|
||||
},
|
||||
{
|
||||
id: "event",
|
||||
display: "Event",
|
||||
availableColumns: observationCols,
|
||||
},
|
||||
];
|
||||
|
||||
export const availableDatasetEvalVariables = [
|
||||
|
||||
@@ -27,16 +27,42 @@ export const parseUnknownToString = (value: unknown): string => {
|
||||
return String(value);
|
||||
};
|
||||
|
||||
/**
|
||||
* Recursively parses JSON strings that may have been encoded multiple times.
|
||||
* This handles cases where data has been JSON.stringify'd multiple times.
|
||||
*
|
||||
* @param value - The potentially multi-encoded JSON string
|
||||
* @returns The final parsed object or the original value if parsing fails
|
||||
*/
|
||||
function parseMultiEncodedJson(value: unknown): unknown {
|
||||
if (typeof value !== "string") {
|
||||
return value;
|
||||
}
|
||||
|
||||
try {
|
||||
const parsed = JSON.parse(value);
|
||||
|
||||
// If result is still a string, it might be double-encoded - recurse
|
||||
if (typeof parsed === "string") {
|
||||
return parseMultiEncodedJson(parsed);
|
||||
}
|
||||
|
||||
return parsed;
|
||||
} catch {
|
||||
// If parsing fails, return original value
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
function parseJsonDefault(selectedColumn: unknown, jsonSelector: string) {
|
||||
// selectedColumn should already be preprocessed by preprocessObjectWithJsonFields
|
||||
// so we can directly use it with JSONPath
|
||||
const result = JSONPath({
|
||||
path: jsonSelector,
|
||||
json:
|
||||
typeof selectedColumn === "string"
|
||||
? JSON.parse(selectedColumn)
|
||||
: selectedColumn,
|
||||
json: selectedColumn as any, // JSONPath accepts unknown but types are strict
|
||||
});
|
||||
|
||||
return result.length > 0 ? result[0] : undefined;
|
||||
return Array.isArray(result) && result.length > 0 ? result[0] : undefined;
|
||||
}
|
||||
|
||||
export function extractValueFromObject(
|
||||
@@ -44,7 +70,13 @@ export function extractValueFromObject(
|
||||
mapping: z.infer<typeof variableMapping>,
|
||||
parseJson?: (selectedColumn: unknown, jsonSelector: string) => unknown, // eslint-disable-line no-unused-vars
|
||||
): { value: string; error: Error | null } {
|
||||
const selectedColumn = obj[mapping.selectedColumnId];
|
||||
let selectedColumn = obj[mapping.selectedColumnId];
|
||||
|
||||
// Simple preprocessing: attempt to parse to valid JSON object
|
||||
if (typeof selectedColumn === "string") {
|
||||
selectedColumn = parseMultiEncodedJson(selectedColumn);
|
||||
}
|
||||
|
||||
const jsonParser = parseJson || parseJsonDefault;
|
||||
|
||||
let jsonSelectedColumn;
|
||||
|
||||
@@ -19,12 +19,17 @@ const executionWrapper = async <T, Y>(
|
||||
return [res, duration];
|
||||
};
|
||||
|
||||
/**
|
||||
* Measures the execution time of two functions and returns the result based on the experiment configuration.
|
||||
* This is used to compare the execution of AggregatingMergeTrees with the existing ReplacingMergeTree execution.
|
||||
*/
|
||||
export const measureAndReturn = async <T, Y>(args: {
|
||||
operationName: string;
|
||||
projectId: string;
|
||||
input: T;
|
||||
existingExecution: (input: T) => Promise<Y>; // eslint-disable-line no-unused-vars
|
||||
newExecution: (input: T) => Promise<Y>; // eslint-disable-line no-unused-vars
|
||||
minStartTime?: Date;
|
||||
}): Promise<Y> => {
|
||||
return instrumentAsync(
|
||||
{
|
||||
@@ -32,13 +37,31 @@ export const measureAndReturn = async <T, Y>(args: {
|
||||
spanKind: opentelemetry.SpanKind.CLIENT,
|
||||
},
|
||||
async (currentSpan) => {
|
||||
const { input, existingExecution, newExecution } = args;
|
||||
const { input, existingExecution, newExecution, minStartTime } = args;
|
||||
|
||||
if (
|
||||
env.LANGFUSE_EXPERIMENT_COMPARE_READ_FROM_AGGREGATING_MERGE_TREES !==
|
||||
"true"
|
||||
) {
|
||||
currentSpan.setAttribute(`langfuse.experiment.amts.run`, "disabled");
|
||||
|
||||
// Check for short-term new result experiment
|
||||
if (
|
||||
env.LANGFUSE_EXPERIMENT_RETURN_NEW_RESULT_SHORT_TERM === "true" &&
|
||||
minStartTime
|
||||
) {
|
||||
const thirtyDaysAgo = new Date();
|
||||
thirtyDaysAgo.setDate(thirtyDaysAgo.getDate() - 30);
|
||||
|
||||
if (minStartTime >= thirtyDaysAgo) {
|
||||
currentSpan.setAttribute(
|
||||
`langfuse.experiment.amts.short-term`,
|
||||
"true",
|
||||
);
|
||||
return newExecution(input);
|
||||
}
|
||||
}
|
||||
|
||||
return env.LANGFUSE_EXPERIMENT_RETURN_NEW_RESULT === "true"
|
||||
? newExecution(input)
|
||||
: existingExecution(input);
|
||||
@@ -93,6 +116,23 @@ export const measureAndReturn = async <T, Y>(args: {
|
||||
);
|
||||
}
|
||||
|
||||
// Check for short-term new result experiment
|
||||
if (
|
||||
env.LANGFUSE_EXPERIMENT_RETURN_NEW_RESULT_SHORT_TERM === "true" &&
|
||||
minStartTime
|
||||
) {
|
||||
const thirtyDaysAgo = new Date();
|
||||
thirtyDaysAgo.setDate(thirtyDaysAgo.getDate() - 30);
|
||||
|
||||
if (minStartTime >= thirtyDaysAgo) {
|
||||
currentSpan.setAttribute(
|
||||
`langfuse.experiment.amts.short-term`,
|
||||
"true",
|
||||
);
|
||||
return newResult;
|
||||
}
|
||||
}
|
||||
|
||||
return env.LANGFUSE_EXPERIMENT_RETURN_NEW_RESULT === "true"
|
||||
? newResult
|
||||
: existingResult;
|
||||
|
||||
@@ -2,7 +2,7 @@ export const ClickhouseTableNames = {
|
||||
traces: "traces",
|
||||
observations: "observations",
|
||||
scores: "scores",
|
||||
dataset_run_items: "dataset_run_items",
|
||||
dataset_run_items_rmt: "dataset_run_items_rmt",
|
||||
|
||||
// Virtual tables for dashboards
|
||||
// TODO: Check if we can do this more elegantly
|
||||
|
||||
@@ -27,6 +27,13 @@ export const getClickhouseEntityType = (
|
||||
case eventTypes.SPAN_UPDATE:
|
||||
case eventTypes.GENERATION_CREATE:
|
||||
case eventTypes.GENERATION_UPDATE:
|
||||
case eventTypes.AGENT_CREATE:
|
||||
case eventTypes.TOOL_CREATE:
|
||||
case eventTypes.CHAIN_CREATE:
|
||||
case eventTypes.RETRIEVER_CREATE:
|
||||
case eventTypes.EVALUATOR_CREATE:
|
||||
case eventTypes.EMBEDDING_CREATE:
|
||||
case eventTypes.GUARDRAIL_CREATE:
|
||||
return "observation";
|
||||
case eventTypes.SCORE_CREATE:
|
||||
return "score";
|
||||
|
||||
@@ -88,7 +88,7 @@ async function removeIngestionEventsFromS3AndDeleteClickhouseRefs(p: {
|
||||
);
|
||||
await softDeleteInClickhouse(blobStorageRefs);
|
||||
logger.info(
|
||||
`Deleted batch ${batch} of size ${blobStorageRefs.length} for ${projectId} of deleting s3 refs`,
|
||||
`Deleted last batch ${batch} of size ${blobStorageRefs.length} for ${projectId} of deleting s3 refs`,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -88,6 +88,7 @@ export async function executeWithDatasetRunItemsStrategy<TInput, TOutput>({
|
||||
return await postgresExecution(input);
|
||||
}
|
||||
} else {
|
||||
// Read from PostgreSQL
|
||||
return await postgresExecution(input);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
import { logger } from "./logger";
|
||||
import { redis } from "./";
|
||||
|
||||
/**
|
||||
* Redis cache utilities for eval job configuration optimization.
|
||||
*
|
||||
* This module provides caching functionality to reduce database calls when
|
||||
* checking for job configurations. When a project has no active evaluation
|
||||
* job configurations, we cache this information in Redis to avoid unnecessary
|
||||
* database queries and queue processing.
|
||||
*/
|
||||
|
||||
const NO_JOB_CONFIG_PREFIX = "langfuse:eval:no-job-configs";
|
||||
|
||||
/**
|
||||
* Check if a project has no job configurations cached in Redis.
|
||||
* Returns true if the cache indicates no eval job configs exist.
|
||||
*
|
||||
* @param projectId - The project ID to check cache for
|
||||
* @returns Promise<boolean> - true if no eval job configs present
|
||||
*/
|
||||
export const hasNoJobConfigsCache = async (
|
||||
projectId: string,
|
||||
): Promise<boolean> => {
|
||||
if (!redis) {
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
const cacheKey = `${NO_JOB_CONFIG_PREFIX}:${projectId}`;
|
||||
const cached = await redis.get(cacheKey);
|
||||
return Boolean(cached);
|
||||
} catch (error) {
|
||||
logger.error("Failed to check no eval job configs cache", error);
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Cache that a project has no active job configurations.
|
||||
* This is set when a database query returns no active EVAL job configurations.
|
||||
* The cache expires after 10 minutes to ensure eventual consistency.
|
||||
*
|
||||
* @param projectId - The project ID to cache
|
||||
*/
|
||||
export const setNoJobConfigsCache = async (
|
||||
projectId: string,
|
||||
): Promise<void> => {
|
||||
if (!redis) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const cacheKey = `${NO_JOB_CONFIG_PREFIX}:${projectId}`;
|
||||
await redis.setex(cacheKey, 600, "1"); // Cache for 10 minutes
|
||||
logger.debug(`Cached no eval job configs for project ${projectId}`);
|
||||
} catch (error) {
|
||||
logger.error("Failed to cache no eval job configs status", error);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Clear the "no eval job configs" cache for a project.
|
||||
* Should be called when job configurations are created or activated.
|
||||
*
|
||||
* @param projectId - The project ID to clear cache for
|
||||
*/
|
||||
export const clearNoJobConfigsCache = async (
|
||||
projectId: string,
|
||||
): Promise<void> => {
|
||||
if (!redis) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const cacheKey = `${NO_JOB_CONFIG_PREFIX}:${projectId}`;
|
||||
await redis.del(cacheKey);
|
||||
logger.debug(`Cleared no eval job configs cache for project ${projectId}`);
|
||||
} catch (error) {
|
||||
logger.error("Failed to clear no eval job configs cache", error);
|
||||
}
|
||||
};
|
||||
@@ -7,6 +7,7 @@ export * from "./services/PromptService";
|
||||
export * from "./services/PromptService/types";
|
||||
export * from "./services/traces-ui-table-service";
|
||||
export * from "./services/InMemoryFilterService";
|
||||
export * from "./evalJobConfigCache";
|
||||
export * from "./auth/apiKeys";
|
||||
export * from "./auth/customSsoProvider";
|
||||
export * from "./auth/gitHubEnterpriseProvider";
|
||||
@@ -14,6 +15,7 @@ export * from "./llm/fetchLLMCompletion";
|
||||
export * from "./llm/utils";
|
||||
export * from "./llm/types";
|
||||
export * from "./llm/compileChatMessages";
|
||||
export * from "./llm/testModelCall";
|
||||
export * from "./utils/DatabaseReadStream";
|
||||
export * from "./utils/transforms";
|
||||
export * from "./clickhouse/client";
|
||||
@@ -58,6 +60,7 @@ export * from "./logger";
|
||||
export * from "./headerPropagation";
|
||||
export * from "./queries";
|
||||
export * from "./repositories";
|
||||
export * from "./utils/rendering";
|
||||
export * from "./redis/evalExecutionQueue";
|
||||
export * from "./services/sessions-ui-table-service";
|
||||
export * from "./services/datasets-ui-table-service";
|
||||
|
||||
@@ -16,6 +16,8 @@ export type ModelMatchProps = {
|
||||
model: string;
|
||||
};
|
||||
|
||||
const MODEL_MATCH_CACHE_LOCKED_KEY = "LOCK:model-match-clear";
|
||||
|
||||
export async function findModel(p: ModelMatchProps): Promise<Model | null> {
|
||||
return instrumentAsync(
|
||||
{
|
||||
@@ -78,6 +80,14 @@ const getModelFromRedis = async (
|
||||
}
|
||||
|
||||
try {
|
||||
if (await isModelMatchCacheLocked()) {
|
||||
logger.info(
|
||||
"Model match cache is locked. Skipping model lookup from Redis.",
|
||||
);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
const key = getRedisModelKey(p);
|
||||
const redisModel = await redis?.get(key);
|
||||
if (redisModel) {
|
||||
@@ -241,6 +251,70 @@ export async function clearModelCacheForProject(
|
||||
);
|
||||
}
|
||||
} catch (error) {
|
||||
logger.error(`Error clearing model cache for project ${projectId}`, error);
|
||||
logger.error(
|
||||
`Error clearing model cache for project ${projectId}: ${error}`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export async function isModelMatchCacheLocked() {
|
||||
try {
|
||||
return Boolean(await redis?.exists(MODEL_MATCH_CACHE_LOCKED_KEY));
|
||||
} catch (err) {
|
||||
logger.error("Failed to check whether model match is locked", err);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
export async function clearFullModelCache() {
|
||||
if (env.LANGFUSE_CACHE_MODEL_MATCH_ENABLED === "false" || !redis) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
// Use lock to protect for concurrent executions
|
||||
// This function is called on worker startup, so we want to avoid all workers triggering this delete
|
||||
if (await isModelMatchCacheLocked()) {
|
||||
logger.info("Model cache clearing already in progress; skipping.");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
const startTime = Date.now();
|
||||
logger.info("Clearing full model cache...");
|
||||
|
||||
const tenMinutesInSeconds = 60 * 10;
|
||||
await redis.setex(
|
||||
MODEL_MATCH_CACHE_LOCKED_KEY,
|
||||
tenMinutesInSeconds,
|
||||
"locked",
|
||||
);
|
||||
|
||||
const pattern = getModelMatchKeyPrefix() + "*";
|
||||
|
||||
const keys =
|
||||
env.REDIS_CLUSTER_ENABLED === "true"
|
||||
? (
|
||||
await Promise.all(
|
||||
(redis as Cluster)
|
||||
.nodes("master")
|
||||
.map((node) => node.keys(pattern) || []),
|
||||
)
|
||||
).flat()
|
||||
: await redis.keys(pattern);
|
||||
|
||||
if (keys.length > 0) {
|
||||
await safeMultiDel(redis, keys);
|
||||
logger.info(
|
||||
`Cleared full model cache with ${keys.length} keys in ${Date.now() - startTime}ms.`,
|
||||
);
|
||||
} else {
|
||||
logger.info(`No keys found for match pattern '${pattern}'`);
|
||||
}
|
||||
} catch (error) {
|
||||
logger.error(`Error clearing full model cache: ${error}`);
|
||||
} finally {
|
||||
await redis?.del(MODEL_MATCH_CACHE_LOCKED_KEY);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -223,6 +223,13 @@ export const eventTypes = {
|
||||
SPAN_UPDATE: "span-update",
|
||||
GENERATION_CREATE: "generation-create",
|
||||
GENERATION_UPDATE: "generation-update",
|
||||
AGENT_CREATE: "agent-create",
|
||||
TOOL_CREATE: "tool-create",
|
||||
CHAIN_CREATE: "chain-create",
|
||||
RETRIEVER_CREATE: "retriever-create",
|
||||
EVALUATOR_CREATE: "evaluator-create",
|
||||
EMBEDDING_CREATE: "embedding-create",
|
||||
GUARDRAIL_CREATE: "guardrail-create",
|
||||
SDK_LOG: "sdk-log",
|
||||
DATASET_RUN_ITEM_CREATE: "dataset-run-item-create",
|
||||
// LEGACY, only required for backwards compatibility
|
||||
@@ -564,6 +571,41 @@ const createAllIngestionSchemas = ({
|
||||
body: UpdateGenerationBody,
|
||||
});
|
||||
|
||||
const agentCreateEvent = base.extend({
|
||||
type: z.literal(eventTypes.AGENT_CREATE),
|
||||
body: CreateGenerationBody,
|
||||
});
|
||||
|
||||
const toolCreateEvent = base.extend({
|
||||
type: z.literal(eventTypes.TOOL_CREATE),
|
||||
body: CreateGenerationBody,
|
||||
});
|
||||
|
||||
const chainCreateEvent = base.extend({
|
||||
type: z.literal(eventTypes.CHAIN_CREATE),
|
||||
body: CreateGenerationBody,
|
||||
});
|
||||
|
||||
const retrieverCreateEvent = base.extend({
|
||||
type: z.literal(eventTypes.RETRIEVER_CREATE),
|
||||
body: CreateGenerationBody,
|
||||
});
|
||||
|
||||
const evaluatorCreateEvent = base.extend({
|
||||
type: z.literal(eventTypes.EVALUATOR_CREATE),
|
||||
body: CreateGenerationBody,
|
||||
});
|
||||
|
||||
const embeddingCreateEvent = base.extend({
|
||||
type: z.literal(eventTypes.EMBEDDING_CREATE),
|
||||
body: CreateGenerationBody,
|
||||
});
|
||||
|
||||
const guardrailCreateEvent = base.extend({
|
||||
type: z.literal(eventTypes.GUARDRAIL_CREATE),
|
||||
body: CreateGenerationBody,
|
||||
});
|
||||
|
||||
const scoreEvent = base.extend({
|
||||
type: z.literal(eventTypes.SCORE_CREATE),
|
||||
body: ScoreBody,
|
||||
@@ -603,6 +645,13 @@ const createAllIngestionSchemas = ({
|
||||
spanUpdateEvent,
|
||||
generationCreateEvent,
|
||||
generationUpdateEvent,
|
||||
agentCreateEvent,
|
||||
toolCreateEvent,
|
||||
chainCreateEvent,
|
||||
retrieverCreateEvent,
|
||||
evaluatorCreateEvent,
|
||||
embeddingCreateEvent,
|
||||
guardrailCreateEvent,
|
||||
sdkLogEvent,
|
||||
datasetRunItemCreateEvent,
|
||||
// LEGACY, only required for backwards compatibility
|
||||
@@ -629,6 +678,13 @@ const createAllIngestionSchemas = ({
|
||||
spanUpdateEvent,
|
||||
generationCreateEvent,
|
||||
generationUpdateEvent,
|
||||
agentCreateEvent,
|
||||
toolCreateEvent,
|
||||
chainCreateEvent,
|
||||
retrieverCreateEvent,
|
||||
evaluatorCreateEvent,
|
||||
embeddingCreateEvent,
|
||||
guardrailCreateEvent,
|
||||
scoreEvent,
|
||||
datasetRunItemCreateEvent,
|
||||
sdkLogEvent,
|
||||
@@ -666,6 +722,13 @@ export const spanCreateEvent = publicSchemas.spanCreateEvent;
|
||||
export const spanUpdateEvent = publicSchemas.spanUpdateEvent;
|
||||
export const generationCreateEvent = publicSchemas.generationCreateEvent;
|
||||
export const generationUpdateEvent = publicSchemas.generationUpdateEvent;
|
||||
export const agentCreateEvent = publicSchemas.agentCreateEvent;
|
||||
export const toolCreateEvent = publicSchemas.toolCreateEvent;
|
||||
export const chainCreateEvent = publicSchemas.chainCreateEvent;
|
||||
export const retrieverCreateEvent = publicSchemas.retrieverCreateEvent;
|
||||
export const evaluatorCreateEvent = publicSchemas.evaluatorCreateEvent;
|
||||
export const embeddingCreateEvent = publicSchemas.embeddingCreateEvent;
|
||||
export const guardrailCreateEvent = publicSchemas.guardrailCreateEvent;
|
||||
export const scoreEvent = publicSchemas.scoreEvent;
|
||||
export const sdkLogEvent = publicSchemas.sdkLogEvent;
|
||||
export const datasetRunItemCreateEvent =
|
||||
@@ -707,4 +770,11 @@ export type ObservationEvent =
|
||||
| z.infer<typeof spanCreateEvent>
|
||||
| z.infer<typeof spanUpdateEvent>
|
||||
| z.infer<typeof generationCreateEvent>
|
||||
| z.infer<typeof generationUpdateEvent>;
|
||||
| z.infer<typeof generationUpdateEvent>
|
||||
| z.infer<typeof agentCreateEvent>
|
||||
| z.infer<typeof toolCreateEvent>
|
||||
| z.infer<typeof chainCreateEvent>
|
||||
| z.infer<typeof retrieverCreateEvent>
|
||||
| z.infer<typeof evaluatorCreateEvent>
|
||||
| z.infer<typeof embeddingCreateEvent>
|
||||
| z.infer<typeof guardrailCreateEvent>;
|
||||
|
||||
@@ -42,6 +42,7 @@ import {
|
||||
} from "./types";
|
||||
import { CallbackHandler } from "langfuse-langchain";
|
||||
import type { BaseCallbackHandler } from "@langchain/core/callbacks/base";
|
||||
import { HttpsProxyAgent } from "https-proxy-agent";
|
||||
|
||||
const isLangfuseCloud = Boolean(env.NEXT_PUBLIC_LANGFUSE_CLOUD_REGION);
|
||||
|
||||
@@ -217,6 +218,10 @@ export async function fetchLLMCompletion(
|
||||
(m) => m.content.length > 0 || "tool_calls" in m,
|
||||
);
|
||||
|
||||
// Common proxy configuration for all adapters
|
||||
const proxyUrl = env.HTTPS_PROXY;
|
||||
const proxyAgent = proxyUrl ? new HttpsProxyAgent(proxyUrl) : undefined;
|
||||
|
||||
let chatModel:
|
||||
| ChatOpenAI
|
||||
| ChatAnthropic
|
||||
@@ -232,7 +237,12 @@ export async function fetchLLMCompletion(
|
||||
maxTokens: modelParams.max_tokens,
|
||||
topP: modelParams.top_p,
|
||||
callbacks: finalCallbacks,
|
||||
clientOptions: { maxRetries, timeout: 1000 * 60 * 2 }, // 2 minutes timeout
|
||||
clientOptions: {
|
||||
maxRetries,
|
||||
timeout: 1000 * 60 * 2, // 2 minutes timeout
|
||||
...(proxyAgent && { httpAgent: proxyAgent }),
|
||||
},
|
||||
invocationKwargs: modelParams.providerOptions,
|
||||
});
|
||||
} else if (modelParams.adapter === LLMAdapter.OpenAI) {
|
||||
chatModel = new ChatOpenAI({
|
||||
@@ -247,7 +257,9 @@ export async function fetchLLMCompletion(
|
||||
configuration: {
|
||||
baseURL,
|
||||
defaultHeaders: extraHeaders,
|
||||
...(proxyAgent && { httpAgent: proxyAgent }),
|
||||
},
|
||||
modelKwargs: modelParams.providerOptions,
|
||||
timeout: 1000 * 60 * 2, // 2 minutes timeout
|
||||
});
|
||||
} else if (modelParams.adapter === LLMAdapter.Azure) {
|
||||
@@ -264,7 +276,9 @@ export async function fetchLLMCompletion(
|
||||
timeout: 1000 * 60 * 2, // 2 minutes timeout
|
||||
configuration: {
|
||||
defaultHeaders: extraHeaders,
|
||||
...(proxyAgent && { httpAgent: proxyAgent }),
|
||||
},
|
||||
modelKwargs: modelParams.providerOptions,
|
||||
});
|
||||
} else if (modelParams.adapter === LLMAdapter.Bedrock) {
|
||||
const { region } = BedrockConfigSchema.parse(config);
|
||||
@@ -284,6 +298,7 @@ export async function fetchLLMCompletion(
|
||||
callbacks: finalCallbacks,
|
||||
maxRetries,
|
||||
timeout: 1000 * 60 * 2, // 2 minutes timeout
|
||||
additionalModelRequestFields: modelParams.providerOptions as any,
|
||||
});
|
||||
} else if (modelParams.adapter === LLMAdapter.VertexAI) {
|
||||
const credentials = GCPServiceAccountKeySchema.parse(JSON.parse(apiKey));
|
||||
@@ -340,51 +355,6 @@ export async function fetchLLMCompletion(
|
||||
};
|
||||
}
|
||||
|
||||
/*
|
||||
Workaround OpenAI reasoning models:
|
||||
|
||||
This is a temporary workaround to avoid sending unsupported parameters to OpenAI's O1 models.
|
||||
O1 models do not support:
|
||||
- system messages
|
||||
- top_p
|
||||
- max_tokens at all, one has to use max_completion_tokens instead
|
||||
- temperature different than 1
|
||||
|
||||
Reference: https://platform.openai.com/docs/guides/reasoning/beta-limitations
|
||||
*/
|
||||
if (
|
||||
modelParams.model.startsWith("o1-") ||
|
||||
modelParams.model.startsWith("o3-")
|
||||
) {
|
||||
const filteredMessages = finalMessages.filter((message) => {
|
||||
return (
|
||||
modelParams.model.startsWith("o3-") || message._getType() !== "system"
|
||||
);
|
||||
});
|
||||
|
||||
return {
|
||||
completion: await new ChatOpenAI({
|
||||
openAIApiKey: apiKey,
|
||||
modelName: modelParams.model,
|
||||
temperature: 1,
|
||||
maxTokens: undefined,
|
||||
topP: undefined,
|
||||
callbacks,
|
||||
maxRetries,
|
||||
modelKwargs: {
|
||||
max_completion_tokens: modelParams.max_tokens,
|
||||
},
|
||||
configuration: {
|
||||
baseURL,
|
||||
},
|
||||
timeout: 1000 * 60 * 2, // 2 minutes timeout
|
||||
})
|
||||
.pipe(new StringOutputParser())
|
||||
.invoke(filteredMessages, runConfig),
|
||||
processTracedEvents,
|
||||
};
|
||||
}
|
||||
|
||||
if (tools && tools.length > 0) {
|
||||
const langchainTools = tools.map((tool) => ({
|
||||
type: "function",
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
import { z as zodV3 } from "zod/v3";
|
||||
import {
|
||||
ChatMessageRole,
|
||||
ChatMessageType,
|
||||
LLMApiKeySchema,
|
||||
type ModelConfig,
|
||||
} from "./types";
|
||||
import { decrypt } from "../../encryption";
|
||||
import { fetchLLMCompletion } from "./fetchLLMCompletion";
|
||||
import { decryptAndParseExtraHeaders } from "./utils";
|
||||
import z from "zod/v4";
|
||||
|
||||
export const testModelCall = async ({
|
||||
provider,
|
||||
model,
|
||||
apiKey,
|
||||
prompt,
|
||||
modelConfig,
|
||||
}: {
|
||||
provider: string;
|
||||
model: string;
|
||||
apiKey: z.infer<typeof LLMApiKeySchema>;
|
||||
prompt?: string;
|
||||
modelConfig?: ModelConfig | null;
|
||||
}) => {
|
||||
(
|
||||
await fetchLLMCompletion({
|
||||
streaming: false,
|
||||
apiKey: decrypt(apiKey.secretKey), // decrypt the secret key
|
||||
extraHeaders: decryptAndParseExtraHeaders(apiKey.extraHeaders),
|
||||
baseURL: apiKey.baseURL ?? undefined,
|
||||
messages: [
|
||||
{
|
||||
role: ChatMessageRole.User,
|
||||
content: prompt ?? "mock content",
|
||||
type: ChatMessageType.User,
|
||||
},
|
||||
],
|
||||
modelParams: {
|
||||
provider: provider,
|
||||
model: model,
|
||||
adapter: apiKey.adapter,
|
||||
...modelConfig,
|
||||
},
|
||||
structuredOutputSchema: zodV3.object({
|
||||
score: zodV3.string(),
|
||||
reasoning: zodV3.string(),
|
||||
}),
|
||||
config: apiKey.config,
|
||||
})
|
||||
).completion;
|
||||
};
|
||||
@@ -6,6 +6,7 @@ import {
|
||||
} from "../../interfaces/customLLMProviderConfigSchemas";
|
||||
import { TokenCountDelegate } from "../ingestion/processEventBatch";
|
||||
import { AuthHeaderValidVerificationResult } from "../auth/types";
|
||||
import { JSONObjectSchema } from "../../utils/zod";
|
||||
|
||||
/* eslint-disable no-unused-vars */
|
||||
// disable lint as this is exported and used in web/worker
|
||||
@@ -271,6 +272,7 @@ export const ZodModelConfig = z.object({
|
||||
max_tokens: z.coerce.number().optional(),
|
||||
temperature: z.coerce.number().optional(),
|
||||
top_p: z.coerce.number().optional(),
|
||||
providerOptions: JSONObjectSchema.optional(),
|
||||
});
|
||||
|
||||
// Experiment config
|
||||
@@ -285,7 +287,7 @@ export const ExperimentMetadataSchema = z
|
||||
.strict();
|
||||
export type ExperimentMetadata = z.infer<typeof ExperimentMetadataSchema>;
|
||||
|
||||
// NOTE: Update docs page when changing this! https://langfuse.com/docs/playground#openai-playground--anthropic-playground
|
||||
// NOTE: Update docs page when changing this! https://langfuse.com/docs/prompt-management/features/playground#openai-playground--anthropic-playground
|
||||
// WARNING: The first entry in the array is chosen as the default model to add LLM API keys
|
||||
export const openAIModels = [
|
||||
"gpt-4.1",
|
||||
@@ -294,6 +296,12 @@ export const openAIModels = [
|
||||
"gpt-4.1-mini-2025-04-14",
|
||||
"gpt-4.1-nano",
|
||||
"gpt-4.1-nano-2025-04-14",
|
||||
"gpt-5",
|
||||
"gpt-5-2025-08-07",
|
||||
"gpt-5-mini",
|
||||
"gpt-5-mini-2025-08-07",
|
||||
"gpt-5-nano",
|
||||
"gpt-5-nano-2025-08-07",
|
||||
"o3",
|
||||
"o3-2025-04-16",
|
||||
"o4-mini",
|
||||
@@ -327,7 +335,7 @@ export const openAIModels = [
|
||||
|
||||
export type OpenAIModel = (typeof openAIModels)[number];
|
||||
|
||||
// NOTE: Update docs page when changing this! https://langfuse.com/docs/playground#openai-playground--anthropic-playground
|
||||
// NOTE: Update docs page when changing this! https://langfuse.com/docs/prompt-management/features/playground#openai-playground--anthropic-playground
|
||||
// WARNING: The first entry in the array is chosen as the default model to add LLM API keys
|
||||
export const anthropicModels = [
|
||||
"claude-sonnet-4-20250514",
|
||||
|
||||
@@ -6,7 +6,6 @@ import { DatasetRunItemUpsertQueue } from "./datasetRunItemUpsert";
|
||||
import { EvalExecutionQueue } from "./evalExecutionQueue";
|
||||
import { ExperimentCreateQueue } from "./experimentCreateQueue";
|
||||
import { SecondaryIngestionQueue } from "./ingestionQueue";
|
||||
import { TraceUpsertQueue } from "./traceUpsert";
|
||||
import { TraceDeleteQueue } from "./traceDelete";
|
||||
import { ProjectDeleteQueue } from "./projectDelete";
|
||||
import { PostHogIntegrationQueue } from "./postHogIntegrationQueue";
|
||||
@@ -25,10 +24,13 @@ import { WebhookQueue } from "./webhookQueue";
|
||||
import { EntityChangeQueue } from "./entityChangeQueue";
|
||||
import { DatasetDeleteQueue } from "./datasetDelete";
|
||||
|
||||
// IngestionQueue is sharded and requires a sharding key
|
||||
// Use IngestionQueue.getInstance({ shardName: queueName }) directly instead
|
||||
// IngestionQueue and TraceUpsert are sharded and require a sharding key
|
||||
// Use IngestionQueue.getInstance({ shardName: queueName }) or TraceUpsertQueue.getInstance({ shardName: queueName }) directly instead
|
||||
export function getQueue(
|
||||
queueName: Exclude<QueueName, QueueName.IngestionQueue>,
|
||||
queueName: Exclude<
|
||||
QueueName,
|
||||
QueueName.IngestionQueue | QueueName.TraceUpsert
|
||||
>,
|
||||
): Queue | null {
|
||||
switch (queueName) {
|
||||
case QueueName.BatchExport:
|
||||
@@ -43,8 +45,6 @@ export function getQueue(
|
||||
return EvalExecutionQueue.getInstance();
|
||||
case QueueName.ExperimentCreate:
|
||||
return ExperimentCreateQueue.getInstance();
|
||||
case QueueName.TraceUpsert:
|
||||
return TraceUpsertQueue.getInstance();
|
||||
case QueueName.TraceDelete:
|
||||
return TraceDeleteQueue.getInstance();
|
||||
case QueueName.ProjectDelete:
|
||||
|
||||
@@ -6,45 +6,92 @@ import {
|
||||
getQueuePrefix,
|
||||
} from "./redis";
|
||||
import { logger } from "../logger";
|
||||
import { getShardIndex } from "./sharding";
|
||||
import { env } from "../../env";
|
||||
|
||||
export class TraceUpsertQueue {
|
||||
private static instance: Queue<TQueueJobTypes[QueueName.TraceUpsert]> | null =
|
||||
null;
|
||||
private static instances: Map<
|
||||
number,
|
||||
Queue<TQueueJobTypes[QueueName.TraceUpsert]> | null
|
||||
> = new Map();
|
||||
|
||||
public static getInstance(): Queue<
|
||||
TQueueJobTypes[QueueName.TraceUpsert]
|
||||
> | null {
|
||||
if (TraceUpsertQueue.instance) return TraceUpsertQueue.instance;
|
||||
public static getShardNames() {
|
||||
return Array.from(
|
||||
{ length: env.LANGFUSE_TRACE_UPSERT_QUEUE_SHARD_COUNT },
|
||||
(_, i) => `${QueueName.TraceUpsert}${i > 0 ? `-${i}` : ""}`,
|
||||
);
|
||||
}
|
||||
|
||||
static getShardIndexFromShardName(
|
||||
shardName: string | undefined,
|
||||
): number | null {
|
||||
if (!shardName) return null;
|
||||
|
||||
// Extract shard index from shard name
|
||||
const shardIndex =
|
||||
shardName === QueueName.TraceUpsert
|
||||
? 0
|
||||
: parseInt(shardName.replace(`${QueueName.TraceUpsert}-`, ""), 10);
|
||||
|
||||
if (isNaN(shardIndex)) return null;
|
||||
return shardIndex;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the trace upsert queue instance for the given sharding key or shard name.
|
||||
* @param shardingKey - ShardingKey is being hashed and randomly allocated to a shard. Should be `projectId-traceId`.
|
||||
* @param shardName - Name of the shard. Should be `trace-upsert-queue-${shardIndex}` or plainly `trace-upsert-queue` for the first shard.
|
||||
*/
|
||||
public static getInstance({
|
||||
shardingKey,
|
||||
shardName,
|
||||
}: {
|
||||
shardingKey?: string;
|
||||
shardName?: string;
|
||||
} = {}): Queue<TQueueJobTypes[QueueName.TraceUpsert]> | null {
|
||||
const shardIndex =
|
||||
TraceUpsertQueue.getShardIndexFromShardName(shardName) ??
|
||||
(env.REDIS_CLUSTER_ENABLED === "true" && shardingKey
|
||||
? getShardIndex(
|
||||
shardingKey,
|
||||
env.LANGFUSE_TRACE_UPSERT_QUEUE_SHARD_COUNT,
|
||||
)
|
||||
: 0);
|
||||
|
||||
// Check if we already have an instance for this shard
|
||||
if (TraceUpsertQueue.instances.has(shardIndex)) {
|
||||
return TraceUpsertQueue.instances.get(shardIndex) || null;
|
||||
}
|
||||
|
||||
const newRedis = createNewRedisInstance({
|
||||
enableOfflineQueue: false,
|
||||
...redisQueueRetryOptions,
|
||||
});
|
||||
|
||||
TraceUpsertQueue.instance = newRedis
|
||||
? new Queue<TQueueJobTypes[QueueName.TraceUpsert]>(
|
||||
QueueName.TraceUpsert,
|
||||
{
|
||||
connection: newRedis,
|
||||
prefix: getQueuePrefix(QueueName.TraceUpsert),
|
||||
defaultJobOptions: {
|
||||
removeOnComplete: 100, // Important: If not true, new jobs for that ID would be ignored as jobs in the complete set are still considered as part of the queue
|
||||
removeOnFail: 100_000,
|
||||
attempts: 5,
|
||||
delay: 15_000, // 15 seconds
|
||||
backoff: {
|
||||
type: "exponential",
|
||||
delay: 5000,
|
||||
},
|
||||
const name = `${QueueName.TraceUpsert}${shardIndex > 0 ? `-${shardIndex}` : ""}`;
|
||||
const queueInstance = newRedis
|
||||
? new Queue<TQueueJobTypes[QueueName.TraceUpsert]>(name, {
|
||||
connection: newRedis,
|
||||
prefix: getQueuePrefix(name),
|
||||
defaultJobOptions: {
|
||||
removeOnComplete: 100,
|
||||
removeOnFail: 100_000,
|
||||
attempts: 5,
|
||||
delay: 15_000, // 15 seconds
|
||||
backoff: {
|
||||
type: "exponential",
|
||||
delay: 5000,
|
||||
},
|
||||
},
|
||||
)
|
||||
})
|
||||
: null;
|
||||
|
||||
TraceUpsertQueue.instance?.on("error", (err) => {
|
||||
logger.error("TraceUpsertQueue error", err);
|
||||
queueInstance?.on("error", (err) => {
|
||||
logger.error(`TraceUpsertQueue shard ${shardIndex} error`, err);
|
||||
});
|
||||
|
||||
return TraceUpsertQueue.instance;
|
||||
TraceUpsertQueue.instances.set(shardIndex, queueInstance);
|
||||
|
||||
return queueInstance;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,14 +17,30 @@ import { DatasetRunItemRecordReadType } from "./definitions";
|
||||
import { env } from "../../env";
|
||||
import { commandClickhouse } from "./clickhouse";
|
||||
import Decimal from "decimal.js";
|
||||
import { ClickHouseClientConfigOptions } from "@clickhouse/client";
|
||||
|
||||
type DatasetItemIdsByTraceIdQuery = {
|
||||
projectId: string;
|
||||
traceId: string;
|
||||
// this filter should include a dataset_id filter to search along primary key
|
||||
filter: FilterState;
|
||||
};
|
||||
|
||||
type DatasetRunItemsTableQuery = {
|
||||
projectId: string;
|
||||
datasetId: string;
|
||||
filter: FilterState;
|
||||
datasetId?: string;
|
||||
orderBy?: OrderByState | OrderByState[];
|
||||
limit?: number;
|
||||
offset?: number;
|
||||
clickhouseConfigs?: ClickHouseClientConfigOptions;
|
||||
};
|
||||
|
||||
type DatasetRunItemsByDatasetIdQuery = Omit<
|
||||
DatasetRunItemsTableQuery,
|
||||
"datasetId"
|
||||
> & {
|
||||
datasetId: string;
|
||||
};
|
||||
|
||||
type DatasetRunsMetricsTableQuery = {
|
||||
@@ -73,22 +89,26 @@ const convertDatasetRunsMetricsRecord = (
|
||||
|
||||
const getProjectDatasetIdDefaultFilter = (
|
||||
projectId: string,
|
||||
datasetId: string,
|
||||
datasetId?: string,
|
||||
) => {
|
||||
return {
|
||||
datasetRunItemsFilter: new FilterList([
|
||||
new StringFilter({
|
||||
clickhouseTable: "dataset_run_items",
|
||||
clickhouseTable: "dataset_run_items_rmt",
|
||||
field: "project_id",
|
||||
operator: "=",
|
||||
value: projectId,
|
||||
}),
|
||||
new StringFilter({
|
||||
clickhouseTable: "dataset_run_items",
|
||||
field: "dataset_id",
|
||||
operator: "=",
|
||||
value: datasetId,
|
||||
}),
|
||||
...(datasetId
|
||||
? [
|
||||
new StringFilter({
|
||||
clickhouseTable: "dataset_run_items_rmt",
|
||||
field: "dataset_id",
|
||||
operator: "=",
|
||||
value: datasetId,
|
||||
}),
|
||||
]
|
||||
: []),
|
||||
]),
|
||||
};
|
||||
};
|
||||
@@ -132,13 +152,13 @@ const getDatasetRunsTableInternal = async <T>(
|
||||
WHERE o.project_id = {projectId: String}
|
||||
AND o.start_time >= (
|
||||
SELECT min(dri.dataset_run_created_at) - INTERVAL 1 DAY
|
||||
FROM dataset_run_items dri
|
||||
FROM dataset_run_items_rmt dri
|
||||
WHERE dri.project_id = {projectId: String}
|
||||
AND dri.dataset_id = {datasetId: String}
|
||||
)
|
||||
AND o.start_time <= (
|
||||
SELECT max(dri.dataset_run_created_at) + INTERVAL 1 DAY
|
||||
FROM dataset_run_items dri
|
||||
FROM dataset_run_items_rmt dri
|
||||
WHERE dri.project_id = {projectId: String}
|
||||
AND dri.dataset_id = {datasetId: String}
|
||||
)
|
||||
@@ -150,7 +170,7 @@ const getDatasetRunsTableInternal = async <T>(
|
||||
dateDiff('millisecond', min(of.start_time), max(of.end_time)) as latency_ms,
|
||||
sum(of.total_cost) as total_cost
|
||||
FROM observations_filtered of
|
||||
JOIN dataset_run_items dri ON dri.trace_id = of.trace_id
|
||||
JOIN dataset_run_items_rmt dri ON dri.trace_id = of.trace_id
|
||||
AND dri.project_id = of.project_id
|
||||
AND dri.observation_id IS NULL -- Only for trace-level dataset run items
|
||||
WHERE dri.dataset_id = {datasetId: String}
|
||||
@@ -163,7 +183,7 @@ const getDatasetRunsTableInternal = async <T>(
|
||||
dri.trace_id,
|
||||
of.total_cost,
|
||||
dateDiff('millisecond', of.start_time, of.end_time) as latency_ms
|
||||
FROM dataset_run_items dri
|
||||
FROM dataset_run_items_rmt dri
|
||||
JOIN observations_filtered of ON dri.observation_id = of.id
|
||||
AND dri.project_id = of.project_id
|
||||
AND dri.trace_id = of.trace_id
|
||||
@@ -190,7 +210,7 @@ const getDatasetRunsTableInternal = async <T>(
|
||||
THEN od.total_cost
|
||||
ELSE COALESCE(ta.total_cost, 0)
|
||||
END) as avg_total_cost
|
||||
FROM dataset_run_items dri
|
||||
FROM dataset_run_items_rmt dri
|
||||
LEFT JOIN traces_aggregated ta
|
||||
ON dri.trace_id = ta.trace_id
|
||||
AND dri.project_id = ta.project_id
|
||||
@@ -317,7 +337,7 @@ const getDatasetRunItemsTableInternal = async <T>(
|
||||
const query = `
|
||||
SELECT
|
||||
${selectString}
|
||||
FROM dataset_run_items dri
|
||||
FROM dataset_run_items_rmt dri
|
||||
WHERE ${appliedFilter.query}
|
||||
${orderByClause}
|
||||
${opts.select === "rows" ? "LIMIT 1 BY dri.project_id, dri.dataset_id, dri.dataset_run_id, dri.dataset_item_id" : ""}
|
||||
@@ -333,14 +353,15 @@ const getDatasetRunItemsTableInternal = async <T>(
|
||||
feature: "datasets",
|
||||
type: "dataset-run-items",
|
||||
projectId,
|
||||
datasetId,
|
||||
...(datasetId ? { datasetId } : {}),
|
||||
},
|
||||
clickhouseConfigs: opts.clickhouseConfigs,
|
||||
});
|
||||
|
||||
return res;
|
||||
};
|
||||
|
||||
export const getDatasetRunItemsByDatasetIdCh = async (
|
||||
export const getDatasetRunItemsCh = async (
|
||||
opts: DatasetRunItemsTableQuery,
|
||||
): Promise<DatasetRunItemDomain[]> => {
|
||||
const rows =
|
||||
@@ -353,7 +374,80 @@ export const getDatasetRunItemsByDatasetIdCh = async (
|
||||
return rows.map(convertDatasetRunItemClickhouseToDomain);
|
||||
};
|
||||
|
||||
export const getDatasetRunItemsCountByDatasetIdCh = async (
|
||||
export const getDatasetRunItemsByDatasetIdCh = async (
|
||||
opts: DatasetRunItemsByDatasetIdQuery,
|
||||
): Promise<DatasetRunItemDomain[]> => {
|
||||
const rows =
|
||||
await getDatasetRunItemsTableInternal<DatasetRunItemRecordReadType>({
|
||||
...opts,
|
||||
select: "rows",
|
||||
tags: { kind: "list" },
|
||||
});
|
||||
|
||||
return rows.map(convertDatasetRunItemClickhouseToDomain);
|
||||
};
|
||||
|
||||
export const getDatasetItemIdsByTraceIdCh = async (
|
||||
opts: DatasetItemIdsByTraceIdQuery,
|
||||
): Promise<{ id: string; datasetId: string }[]> => {
|
||||
const { projectId, traceId, filter } = opts;
|
||||
|
||||
const datasetRunItemsFilter = new FilterList([
|
||||
new StringFilter({
|
||||
clickhouseTable: "dataset_run_items_rmt",
|
||||
field: "project_id",
|
||||
operator: "=",
|
||||
value: projectId,
|
||||
}),
|
||||
new StringFilter({
|
||||
clickhouseTable: "dataset_run_items_rmt",
|
||||
field: "trace_id",
|
||||
operator: "=",
|
||||
value: traceId,
|
||||
}),
|
||||
]);
|
||||
|
||||
datasetRunItemsFilter.push(
|
||||
...createFilterFromFilterState(
|
||||
filter,
|
||||
datasetRunItemsTableUiColumnDefinitions,
|
||||
),
|
||||
);
|
||||
const appliedFilter = datasetRunItemsFilter.apply();
|
||||
|
||||
const query = `
|
||||
SELECT
|
||||
dri.dataset_item_id as dataset_item_id,
|
||||
dri.dataset_id as dataset_id
|
||||
FROM dataset_run_items_rmt dri
|
||||
WHERE ${appliedFilter.query}
|
||||
LIMIT 1 BY dri.project_id, dri.dataset_id, dri.dataset_run_id, dri.dataset_item_id;`;
|
||||
|
||||
const res = await queryClickhouse<{
|
||||
dataset_item_id: string;
|
||||
dataset_id: string;
|
||||
}>({
|
||||
query,
|
||||
params: {
|
||||
...appliedFilter.params,
|
||||
},
|
||||
tags: {
|
||||
feature: "datasets",
|
||||
type: "dataset-run-items",
|
||||
projectId,
|
||||
traceId,
|
||||
},
|
||||
});
|
||||
|
||||
return res.map((runItem) => {
|
||||
return {
|
||||
id: runItem.dataset_item_id,
|
||||
datasetId: runItem.dataset_id,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
export const getDatasetRunItemsCountCh = async (
|
||||
opts: DatasetRunItemsTableQuery,
|
||||
): Promise<number> => {
|
||||
const rows = await getDatasetRunItemsTableInternal<{ count: string }>({
|
||||
@@ -365,13 +459,25 @@ export const getDatasetRunItemsCountByDatasetIdCh = async (
|
||||
return Number(rows[0]?.count);
|
||||
};
|
||||
|
||||
export const getDatasetRunItemsCountByDatasetIdCh = async (
|
||||
opts: DatasetRunItemsByDatasetIdQuery,
|
||||
): Promise<number> => {
|
||||
const rows = await getDatasetRunItemsTableInternal<{ count: string }>({
|
||||
...opts,
|
||||
select: "count",
|
||||
tags: { kind: "list" },
|
||||
});
|
||||
|
||||
return Number(rows[0]?.count);
|
||||
};
|
||||
|
||||
export const deleteDatasetRunItemsByProjectId = async ({
|
||||
projectId,
|
||||
}: {
|
||||
projectId: string;
|
||||
}) => {
|
||||
const query = `
|
||||
DELETE FROM dataset_run_items
|
||||
DELETE FROM dataset_run_items_rmt
|
||||
WHERE project_id = {projectId: String};
|
||||
`;
|
||||
await commandClickhouse({
|
||||
@@ -399,7 +505,7 @@ export const deleteDatasetRunItemsByDatasetId = async ({
|
||||
datasetId: string;
|
||||
}) => {
|
||||
const query = `
|
||||
DELETE FROM dataset_run_items
|
||||
DELETE FROM dataset_run_items_rmt
|
||||
WHERE project_id = {projectId: String}
|
||||
AND dataset_id = {datasetId: String}
|
||||
`;
|
||||
@@ -432,7 +538,7 @@ export const deleteDatasetRunItemsByDatasetRunIds = async ({
|
||||
datasetId: string;
|
||||
}) => {
|
||||
const query = `
|
||||
DELETE FROM dataset_run_items
|
||||
DELETE FROM dataset_run_items_rmt
|
||||
WHERE project_id = {projectId: String}
|
||||
AND dataset_id = {datasetId: String}
|
||||
AND dataset_run_id IN ({datasetRunIds: Array(String)})
|
||||
|
||||
@@ -37,6 +37,7 @@ import { TracingSearchType } from "../../interfaces/search";
|
||||
import { ClickHouseClientConfigOptions } from "@clickhouse/client";
|
||||
import { ObservationType } from "../../domain";
|
||||
import { recordDistribution } from "../instrumentation";
|
||||
import { DEFAULT_RENDERING_PROPS, RenderingProps } from "../utils/rendering";
|
||||
|
||||
/**
|
||||
* Checks if observation exists in clickhouse.
|
||||
@@ -289,7 +290,7 @@ export const getObservationForTraceIdByName = async (
|
||||
},
|
||||
});
|
||||
|
||||
return records.map(convertObservation);
|
||||
return records.map((record) => convertObservation(record));
|
||||
};
|
||||
|
||||
export const getObservationById = async ({
|
||||
@@ -299,6 +300,7 @@ export const getObservationById = async ({
|
||||
startTime,
|
||||
type,
|
||||
traceId,
|
||||
renderingProps = DEFAULT_RENDERING_PROPS,
|
||||
}: {
|
||||
id: string;
|
||||
projectId: string;
|
||||
@@ -306,6 +308,7 @@ export const getObservationById = async ({
|
||||
startTime?: Date;
|
||||
type?: ObservationType;
|
||||
traceId?: string;
|
||||
renderingProps?: RenderingProps;
|
||||
}) => {
|
||||
const records = await getObservationByIdInternal({
|
||||
id,
|
||||
@@ -314,8 +317,11 @@ export const getObservationById = async ({
|
||||
startTime,
|
||||
type,
|
||||
traceId,
|
||||
renderingProps,
|
||||
});
|
||||
const mapped = records.map(convertObservation);
|
||||
const mapped = records.map((record) =>
|
||||
convertObservation(record, renderingProps),
|
||||
);
|
||||
|
||||
mapped.forEach((observation) => {
|
||||
recordDistribution(
|
||||
@@ -385,7 +391,7 @@ export const getObservationsById = async (
|
||||
query,
|
||||
params: { ids, projectId },
|
||||
});
|
||||
return records.map(convertObservation);
|
||||
return records.map((record) => convertObservation(record));
|
||||
};
|
||||
|
||||
const getObservationByIdInternal = async ({
|
||||
@@ -395,6 +401,7 @@ const getObservationByIdInternal = async ({
|
||||
startTime,
|
||||
type,
|
||||
traceId,
|
||||
renderingProps = DEFAULT_RENDERING_PROPS,
|
||||
}: {
|
||||
id: string;
|
||||
projectId: string;
|
||||
@@ -402,6 +409,7 @@ const getObservationByIdInternal = async ({
|
||||
startTime?: Date;
|
||||
type?: ObservationType;
|
||||
traceId?: string;
|
||||
renderingProps?: RenderingProps;
|
||||
}) => {
|
||||
const query = `
|
||||
SELECT
|
||||
@@ -418,7 +426,7 @@ const getObservationByIdInternal = async ({
|
||||
level,
|
||||
status_message,
|
||||
version,
|
||||
${fetchWithInputOutput ? "input, output," : ""}
|
||||
${fetchWithInputOutput ? (renderingProps.truncated ? `left(input, ${env.LANGFUSE_SERVER_SIDE_IO_CHAR_LIMIT}) as input, left(output, ${env.LANGFUSE_SERVER_SIDE_IO_CHAR_LIMIT}) as output,` : "input, output,") : ""}
|
||||
provided_model_name,
|
||||
internal_model_id,
|
||||
model_parameters,
|
||||
@@ -764,6 +772,7 @@ const getObservationsTableInternal = async <T>(
|
||||
return measureAndReturn({
|
||||
operationName: "getObservationsTableInternal",
|
||||
projectId,
|
||||
minStartTime: (timeFilter?.value as Date) || undefined,
|
||||
input: {
|
||||
params: {
|
||||
...appliedScoresFilter.params,
|
||||
@@ -1499,6 +1508,15 @@ export const getGenerationsForPostHog = async function* (
|
||||
minTimestamp: Date,
|
||||
maxTimestamp: Date,
|
||||
) {
|
||||
// Determine which trace table to use based on experiment flag
|
||||
const useAMT = env.LANGFUSE_EXPERIMENT_RETURN_NEW_RESULT === "true";
|
||||
// Subtract 7d from minTimestamp to account for shift in query
|
||||
const traceTable = useAMT
|
||||
? getTimeframesTracesAMT(
|
||||
new Date(minTimestamp.getTime() - 7 * 24 * 60 * 60 * 1000),
|
||||
)
|
||||
: "traces";
|
||||
|
||||
const query = `
|
||||
SELECT
|
||||
o.name as name,
|
||||
@@ -1523,7 +1541,7 @@ export const getGenerationsForPostHog = async function* (
|
||||
t.tags as trace_tags,
|
||||
t.metadata['$posthog_session_id'] as posthog_session_id
|
||||
FROM observations o FINAL
|
||||
LEFT JOIN traces t FINAL ON o.trace_id = t.id AND o.project_id = t.project_id
|
||||
LEFT JOIN ${traceTable} t FINAL ON o.trace_id = t.id AND o.project_id = t.project_id
|
||||
WHERE o.project_id = {projectId: String}
|
||||
AND t.project_id = {projectId: String}
|
||||
AND o.start_time >= {minTimestamp: DateTime64(3)}
|
||||
@@ -1545,6 +1563,7 @@ export const getGenerationsForPostHog = async function* (
|
||||
type: "observation",
|
||||
kind: "analytic",
|
||||
projectId,
|
||||
experiment_amt: useAMT ? "new" : "original",
|
||||
},
|
||||
clickhouseConfigs: {
|
||||
request_timeout: env.LANGFUSE_CLICKHOUSE_DATA_EXPORT_REQUEST_TIMEOUT_MS,
|
||||
|
||||
@@ -1,15 +1,20 @@
|
||||
import { parseClickhouseUTCDateTimeFormat } from "./clickhouse";
|
||||
import { ObservationRecordReadType } from "./definitions";
|
||||
import { parseJsonPrioritised } from "../../utils/json";
|
||||
import {
|
||||
Observation,
|
||||
ObservationLevelType,
|
||||
ObservationType,
|
||||
} from "../../domain";
|
||||
import { parseMetadataCHRecordToDomain } from "../utils/metadata_conversion";
|
||||
import {
|
||||
RenderingProps,
|
||||
DEFAULT_RENDERING_PROPS,
|
||||
applyInputOutputRendering,
|
||||
} from "../utils/rendering";
|
||||
|
||||
export const convertObservation = (
|
||||
record: ObservationRecordReadType,
|
||||
renderingProps: RenderingProps = DEFAULT_RENDERING_PROPS,
|
||||
): Observation => {
|
||||
const reducedCostDetails = reduceUsageOrCostDetails(record.cost_details);
|
||||
const reducedUsageDetails = reduceUsageOrCostDetails(record.usage_details);
|
||||
@@ -30,10 +35,8 @@ export const convertObservation = (
|
||||
level: record.level as ObservationLevelType,
|
||||
statusMessage: record.status_message ?? null,
|
||||
version: record.version ?? null,
|
||||
input: record.input ? (parseJsonPrioritised(record.input) ?? null) : null,
|
||||
output: record.output
|
||||
? (parseJsonPrioritised(record.output) ?? null)
|
||||
: null,
|
||||
input: applyInputOutputRendering(record.input, renderingProps),
|
||||
output: applyInputOutputRendering(record.output, renderingProps),
|
||||
modelParameters: record.model_parameters
|
||||
? (JSON.parse(record.model_parameters) ?? null)
|
||||
: null,
|
||||
|
||||
@@ -33,6 +33,7 @@ import { ClickHouseClientConfigOptions } from "@clickhouse/client";
|
||||
import { recordDistribution } from "../instrumentation";
|
||||
import { prisma } from "../../db";
|
||||
import { measureAndReturn } from "../clickhouse/measureAndReturn";
|
||||
import { getTimeframesTracesAMT } from "./traces";
|
||||
|
||||
export const searchExistingAnnotationScore = async (
|
||||
projectId: string,
|
||||
@@ -296,7 +297,7 @@ export const getTraceScoresForDatasetRuns = async (
|
||||
s.* EXCEPT (metadata),
|
||||
length(mapKeys(s.metadata)) > 0 AS has_metadata,
|
||||
dri.dataset_run_id as run_id
|
||||
FROM dataset_run_items dri
|
||||
FROM dataset_run_items_rmt dri
|
||||
JOIN scores s FINAL ON dri.trace_id = s.trace_id
|
||||
AND dri.project_id = s.project_id
|
||||
WHERE dri.project_id = {projectId: String}
|
||||
@@ -1152,7 +1153,7 @@ export const getNumericScoreHistogram = async (
|
||||
const query = `
|
||||
select s.value
|
||||
from scores s
|
||||
${traceFilter ? `LEFT JOIN traces t ON s.trace_id = t.id AND t.project_id = s.project_id` : ""}
|
||||
${traceFilter ? `LEFT JOIN __TRACE_TABLE__ t ON s.trace_id = t.id AND t.project_id = s.project_id` : ""}
|
||||
WHERE s.project_id = {projectId: String}
|
||||
${traceFilter ? `AND t.project_id = {projectId: String}` : ""}
|
||||
${chFilterRes?.query ? `AND ${chFilterRes.query}` : ""}
|
||||
@@ -1161,18 +1162,45 @@ export const getNumericScoreHistogram = async (
|
||||
${limit !== undefined ? `limit {limit: Int32}` : ""}
|
||||
`;
|
||||
|
||||
return queryClickhouse<{ value: number }>({
|
||||
query,
|
||||
params: {
|
||||
projectId,
|
||||
limit,
|
||||
...(chFilterRes ? chFilterRes.params : {}),
|
||||
// Extract timestamp from filter for AMT table selection
|
||||
const timestampFilter = chFilter.find(
|
||||
(f) => f.clickhouseTable === "traces" && f.field === "timestamp",
|
||||
) as TimeFilter | undefined;
|
||||
const timestamp = timestampFilter?.value;
|
||||
|
||||
return measureAndReturn({
|
||||
operationName: "getNumericScoreHistogram",
|
||||
projectId,
|
||||
minStartTime: timestamp,
|
||||
input: {
|
||||
params: {
|
||||
projectId,
|
||||
limit,
|
||||
...(chFilterRes ? chFilterRes.params : {}),
|
||||
},
|
||||
tags: {
|
||||
feature: "tracing",
|
||||
type: "score",
|
||||
kind: "analytic",
|
||||
projectId,
|
||||
operation_name: "getNumericScoreHistogram",
|
||||
},
|
||||
timestamp,
|
||||
},
|
||||
tags: {
|
||||
feature: "tracing",
|
||||
type: "score",
|
||||
kind: "analytic",
|
||||
projectId,
|
||||
existingExecution: async (input) => {
|
||||
return queryClickhouse<{ value: number }>({
|
||||
query: query.replace("__TRACE_TABLE__", "traces"),
|
||||
params: input.params,
|
||||
tags: { ...input.tags, experiment_amt: "original" },
|
||||
});
|
||||
},
|
||||
newExecution: async (input) => {
|
||||
const traceAmt = getTimeframesTracesAMT(input.timestamp);
|
||||
return queryClickhouse<{ value: number }>({
|
||||
query: query.replace("__TRACE_TABLE__", traceAmt),
|
||||
params: input.params,
|
||||
tags: { ...input.tags, experiment_amt: "new" },
|
||||
});
|
||||
},
|
||||
});
|
||||
};
|
||||
@@ -1399,6 +1427,15 @@ export const getScoresForPostHog = async function* (
|
||||
minTimestamp: Date,
|
||||
maxTimestamp: Date,
|
||||
) {
|
||||
// Determine which trace table to use based on experiment flag
|
||||
const useAMT = env.LANGFUSE_EXPERIMENT_RETURN_NEW_RESULT === "true";
|
||||
// Subtract 7d from minTimestamp to account for shift in query
|
||||
const traceTable = useAMT
|
||||
? getTimeframesTracesAMT(
|
||||
new Date(minTimestamp.getTime() - 7 * 24 * 60 * 60 * 1000),
|
||||
)
|
||||
: "traces";
|
||||
|
||||
const query = ` SELECT
|
||||
s.id as id,
|
||||
s.timestamp as timestamp,
|
||||
@@ -1417,7 +1454,7 @@ export const getScoresForPostHog = async function* (
|
||||
s.metadata as metadata,
|
||||
t.metadata['$posthog_session_id'] as posthog_session_id
|
||||
FROM scores s FINAL
|
||||
LEFT JOIN traces t FINAL ON s.trace_id = t.id AND s.project_id = t.project_id
|
||||
LEFT JOIN ${traceTable} t FINAL ON s.trace_id = t.id AND s.project_id = t.project_id
|
||||
WHERE s.project_id = {projectId: String}
|
||||
AND t.project_id = {projectId: String}
|
||||
AND s.timestamp >= {minTimestamp: DateTime64(3)}
|
||||
@@ -1438,6 +1475,7 @@ export const getScoresForPostHog = async function* (
|
||||
type: "score",
|
||||
kind: "analytic",
|
||||
projectId,
|
||||
experiment_amt: useAMT ? "new" : "original",
|
||||
},
|
||||
clickhouseConfigs: {
|
||||
request_timeout: env.LANGFUSE_CLICKHOUSE_DATA_EXPORT_REQUEST_TIMEOUT_MS,
|
||||
|
||||
@@ -32,6 +32,7 @@ import { env } from "../../env";
|
||||
import { ClickHouseClientConfigOptions } from "@clickhouse/client";
|
||||
import { recordDistribution } from "../instrumentation";
|
||||
import { measureAndReturn } from "../clickhouse/measureAndReturn";
|
||||
import { DEFAULT_RENDERING_PROPS, RenderingProps } from "../utils/rendering";
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
enum TracesAMTs {
|
||||
@@ -46,12 +47,16 @@ enum TracesAMTs {
|
||||
* for <= 29 days, we use traces_30d_amt,
|
||||
* for all other cases we use traces_all_amt.
|
||||
*
|
||||
* If LANGFUSE_EXPERIMENT_WHITELISTED_AMT_TABLES is set, we only return timeframes
|
||||
* that are whitelisted or fallback to the traces_all_amt.
|
||||
*
|
||||
* @param fromTimestamp
|
||||
*/
|
||||
export const getTimeframesTracesAMT = (
|
||||
fromTimestamp: Date | undefined,
|
||||
): TracesAMTs => {
|
||||
if (!fromTimestamp) {
|
||||
// The TracesAllAMT must always be returned if there is no timestamp.
|
||||
return TracesAMTs.TracesAllAMT;
|
||||
}
|
||||
|
||||
@@ -59,12 +64,21 @@ export const getTimeframesTracesAMT = (
|
||||
const diffInDays = Math.floor(
|
||||
(now.getTime() - fromTimestamp.getTime()) / (1000 * 60 * 60 * 24),
|
||||
);
|
||||
|
||||
let selectedTable: TracesAMTs;
|
||||
if (diffInDays <= 6) {
|
||||
return TracesAMTs.Traces7dAMT;
|
||||
selectedTable = TracesAMTs.Traces7dAMT;
|
||||
} else if (diffInDays <= 29) {
|
||||
return TracesAMTs.Traces30dAMT;
|
||||
selectedTable = TracesAMTs.Traces30dAMT;
|
||||
} else {
|
||||
selectedTable = TracesAMTs.TracesAllAMT;
|
||||
}
|
||||
return TracesAMTs.TracesAllAMT;
|
||||
|
||||
// Check if the selected table is whitelisted, fallback to TracesAllAMT if not
|
||||
return env.LANGFUSE_EXPERIMENT_WHITELISTED_AMT_TABLES.length === 0 ||
|
||||
env.LANGFUSE_EXPERIMENT_WHITELISTED_AMT_TABLES.includes(selectedTable)
|
||||
? selectedTable
|
||||
: TracesAMTs.TracesAllAMT;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -146,6 +160,7 @@ export const checkTraceExists = async ({
|
||||
return measureAndReturn({
|
||||
operationName: "checkTraceExists",
|
||||
projectId,
|
||||
minStartTime: timestamp ?? exactTimestamp,
|
||||
input: {
|
||||
params: {
|
||||
projectId,
|
||||
@@ -355,7 +370,9 @@ export const getTracesByIds = async (
|
||||
},
|
||||
});
|
||||
|
||||
return records.map((record) => convertClickhouseToDomain(record, false));
|
||||
return records.map((record) =>
|
||||
convertClickhouseToDomain(record, DEFAULT_RENDERING_PROPS),
|
||||
);
|
||||
};
|
||||
|
||||
export const getTracesBySessionId = async (
|
||||
@@ -366,6 +383,7 @@ export const getTracesBySessionId = async (
|
||||
const records = await measureAndReturn({
|
||||
operationName: "getTracesBySessionId",
|
||||
projectId,
|
||||
minStartTime: timestamp,
|
||||
input: {
|
||||
params: {
|
||||
sessionIds,
|
||||
@@ -433,7 +451,7 @@ export const getTracesBySessionId = async (
|
||||
});
|
||||
|
||||
const traces = records.map((record) =>
|
||||
convertClickhouseToDomain(record, false),
|
||||
convertClickhouseToDomain(record, DEFAULT_RENDERING_PROPS),
|
||||
);
|
||||
|
||||
traces.forEach((trace) => {
|
||||
@@ -509,6 +527,7 @@ export const getTraceCountsByProjectInCreationInterval = async ({
|
||||
return measureAndReturn({
|
||||
operationName: "getTraceCountsByProjectInCreationInterval",
|
||||
projectId: "__CROSS_PROJECT__",
|
||||
minStartTime: start,
|
||||
input: {
|
||||
params: {
|
||||
start: convertDateToClickhouseDateTime(start),
|
||||
@@ -584,6 +603,7 @@ export const getTraceCountOfProjectsSinceCreationDate = async ({
|
||||
return measureAndReturn({
|
||||
operationName: "getTraceCountOfProjectsSinceCreationDate",
|
||||
projectId: "__CROSS_PROJECT__",
|
||||
minStartTime: start,
|
||||
input: {
|
||||
params: {
|
||||
projectIds,
|
||||
@@ -647,17 +667,18 @@ export const getTraceById = async ({
|
||||
projectId,
|
||||
timestamp,
|
||||
fromTimestamp,
|
||||
truncated = false,
|
||||
renderingProps = DEFAULT_RENDERING_PROPS,
|
||||
}: {
|
||||
traceId: string;
|
||||
projectId: string;
|
||||
timestamp?: Date;
|
||||
fromTimestamp?: Date;
|
||||
truncated?: boolean;
|
||||
renderingProps?: RenderingProps;
|
||||
}) => {
|
||||
const records = await measureAndReturn({
|
||||
operationName: "getTraceById",
|
||||
projectId,
|
||||
minStartTime: fromTimestamp ?? timestamp,
|
||||
input: {
|
||||
params: {
|
||||
traceId,
|
||||
@@ -691,8 +712,8 @@ export const getTraceById = async ({
|
||||
public as public,
|
||||
bookmarked as bookmarked,
|
||||
tags,
|
||||
${truncated ? `left(input, ${env.LANGFUSE_SERVER_SIDE_IO_CHAR_LIMIT})` : "input"} as input,
|
||||
${truncated ? `left(output, ${env.LANGFUSE_SERVER_SIDE_IO_CHAR_LIMIT})` : "output"} as output,
|
||||
${renderingProps.truncated ? `left(input, ${env.LANGFUSE_SERVER_SIDE_IO_CHAR_LIMIT})` : "input"} as input,
|
||||
${renderingProps.truncated ? `left(output, ${env.LANGFUSE_SERVER_SIDE_IO_CHAR_LIMIT})` : "output"} as output,
|
||||
session_id as session_id,
|
||||
0 as is_deleted,
|
||||
timestamp,
|
||||
@@ -717,27 +738,28 @@ export const getTraceById = async ({
|
||||
const query = `
|
||||
SELECT
|
||||
id,
|
||||
name as name,
|
||||
user_id as user_id,
|
||||
metadata as metadata,
|
||||
release as release,
|
||||
version as version,
|
||||
anyLast(name) as name,
|
||||
anyLast(user_id) as user_id,
|
||||
maxMap(metadata) as metadata,
|
||||
anyLast(release) as release,
|
||||
anyLast(version) as version,
|
||||
project_id,
|
||||
environment,
|
||||
finalizeAggregation(public) as public,
|
||||
finalizeAggregation(bookmarked) as bookmarked,
|
||||
tags,
|
||||
finalizeAggregation(input) as input,
|
||||
finalizeAggregation(output) as output,
|
||||
session_id as session_id,
|
||||
anyLast(environment) as environment,
|
||||
argMaxMerge(public) as public,
|
||||
argMaxMerge(bookmarked) as bookmarked,
|
||||
groupUniqArrayArray(tags) as tags,
|
||||
${renderingProps.truncated ? `left(argMaxMerge(input), ${env.LANGFUSE_SERVER_SIDE_IO_CHAR_LIMIT})` : "argMaxMerge(input)"} as input,
|
||||
${renderingProps.truncated ? `left(argMaxMerge(output), ${env.LANGFUSE_SERVER_SIDE_IO_CHAR_LIMIT})` : "argMaxMerge(output)"} as output,
|
||||
anyLast(session_id) as session_id,
|
||||
0 as is_deleted,
|
||||
start_time as timestamp,
|
||||
created_at,
|
||||
updated_at,
|
||||
updated_at as event_ts
|
||||
FROM traces_all_amt
|
||||
min(start_time) as timestamp,
|
||||
min(start_time) as created_at,
|
||||
max(t.updated_at) as updated_at,
|
||||
max(t.updated_at) as event_ts
|
||||
FROM traces_all_amt t
|
||||
WHERE id = {traceId: String}
|
||||
AND project_id = {projectId: String}
|
||||
GROUP BY project_id, id
|
||||
LIMIT 1
|
||||
`;
|
||||
|
||||
@@ -750,7 +772,7 @@ export const getTraceById = async ({
|
||||
});
|
||||
|
||||
const res = records.map((record) =>
|
||||
convertClickhouseToDomain(record, truncated),
|
||||
convertClickhouseToDomain(record, renderingProps),
|
||||
);
|
||||
|
||||
res.forEach((trace) => {
|
||||
@@ -782,6 +804,10 @@ export const getTracesGroupedByName = async (
|
||||
return measureAndReturn({
|
||||
operationName: "getTracesGroupedByName",
|
||||
projectId,
|
||||
minStartTime: timestampFilter?.find(
|
||||
(f) =>
|
||||
f.column === "timestamp" && (f.operator === ">=" || f.operator === ">"),
|
||||
)?.value as Date | undefined,
|
||||
input: {
|
||||
params: {
|
||||
projectId,
|
||||
@@ -877,6 +903,10 @@ export const getTracesGroupedByUsers = async (
|
||||
return measureAndReturn({
|
||||
operationName: "getTracesGroupedByUsers",
|
||||
projectId,
|
||||
minStartTime: filter?.find(
|
||||
(f) =>
|
||||
f.column === "timestamp" && (f.operator === ">=" || f.operator === ">"),
|
||||
)?.value as Date | undefined,
|
||||
input: {
|
||||
params: {
|
||||
limit,
|
||||
@@ -974,6 +1004,10 @@ export const getTracesGroupedByTags = async (props: GroupedTracesQueryProp) => {
|
||||
return measureAndReturn({
|
||||
operationName: "getTracesGroupedByTags",
|
||||
projectId,
|
||||
minStartTime: filter?.find(
|
||||
(f) =>
|
||||
f.column === "timestamp" && (f.operator === ">=" || f.operator === ">"),
|
||||
)?.value as Date | undefined,
|
||||
input: {
|
||||
params: {
|
||||
projectId,
|
||||
@@ -1164,19 +1198,6 @@ export const deleteTraces = async (projectId: string, traceIds: string[]) => {
|
||||
},
|
||||
tags: input.tags,
|
||||
}),
|
||||
// Delete from traces_null
|
||||
commandClickhouse({
|
||||
query: `
|
||||
DELETE FROM traces_null
|
||||
WHERE project_id = {projectId: String}
|
||||
AND id IN ({traceIds: Array(String)});
|
||||
`,
|
||||
params: input.params,
|
||||
clickhouseConfigs: {
|
||||
request_timeout: env.LANGFUSE_CLICKHOUSE_DELETION_TIMEOUT_MS,
|
||||
},
|
||||
tags: input.tags,
|
||||
}),
|
||||
// Delete from traces_all_amt
|
||||
commandClickhouse({
|
||||
query: `
|
||||
@@ -1270,19 +1291,6 @@ export const deleteTracesOlderThanDays = async (
|
||||
},
|
||||
tags: input.tags,
|
||||
}),
|
||||
// Delete from traces_null
|
||||
commandClickhouse({
|
||||
query: `
|
||||
DELETE FROM traces_null
|
||||
WHERE project_id = {projectId: String}
|
||||
AND start_time < {cutoffDate: DateTime64(3)};
|
||||
`,
|
||||
params: input.params,
|
||||
clickhouseConfigs: {
|
||||
request_timeout: env.LANGFUSE_CLICKHOUSE_DELETION_TIMEOUT_MS,
|
||||
},
|
||||
tags: input.tags,
|
||||
}),
|
||||
// Delete from traces_all_amt
|
||||
commandClickhouse({
|
||||
query: `
|
||||
@@ -1370,18 +1378,6 @@ export const deleteTracesByProjectId = async (projectId: string) => {
|
||||
},
|
||||
tags: input.tags,
|
||||
}),
|
||||
// Delete from traces_null
|
||||
commandClickhouse({
|
||||
query: `
|
||||
DELETE FROM traces_null
|
||||
WHERE project_id = {projectId: String};
|
||||
`,
|
||||
params: input.params,
|
||||
clickhouseConfigs: {
|
||||
request_timeout: env.LANGFUSE_CLICKHOUSE_DELETION_TIMEOUT_MS,
|
||||
},
|
||||
tags: input.tags,
|
||||
}),
|
||||
// Delete from traces_all_amt
|
||||
commandClickhouse({
|
||||
query: `
|
||||
@@ -1499,6 +1495,10 @@ export const getTotalUserCount = async (
|
||||
return measureAndReturn({
|
||||
operationName: "getTotalUserCount",
|
||||
projectId,
|
||||
minStartTime: filter?.find(
|
||||
(f) =>
|
||||
f.column === "timestamp" && (f.operator === ">=" || f.operator === ">"),
|
||||
)?.value as Date | undefined,
|
||||
input: {
|
||||
params: {
|
||||
...tracesFilterRes.params,
|
||||
@@ -1648,6 +1648,10 @@ export const getUserMetrics = async (
|
||||
return measureAndReturn({
|
||||
operationName: "getUserMetrics",
|
||||
projectId,
|
||||
minStartTime: filter?.find(
|
||||
(f) =>
|
||||
f.column === "timestamp" && (f.operator === ">=" || f.operator === ">"),
|
||||
)?.value as Date | undefined,
|
||||
input: {
|
||||
params: {
|
||||
projectId,
|
||||
@@ -1746,6 +1750,10 @@ export const getTracesForBlobStorageExport = function (
|
||||
minTimestamp: Date,
|
||||
maxTimestamp: Date,
|
||||
) {
|
||||
// Determine which trace table to use based on experiment flag
|
||||
const useAMT = env.LANGFUSE_EXPERIMENT_RETURN_NEW_RESULT === "true";
|
||||
const traceTable = useAMT ? getTimeframesTracesAMT(minTimestamp) : "traces";
|
||||
|
||||
const query = `
|
||||
SELECT
|
||||
id,
|
||||
@@ -1758,12 +1766,12 @@ export const getTracesForBlobStorageExport = function (
|
||||
session_id,
|
||||
release,
|
||||
version,
|
||||
public,
|
||||
bookmarked,
|
||||
${useAMT ? "finalizeAggregation(public)" : "public"} as public,
|
||||
${useAMT ? "finalizeAggregation(bookmarked)" : "bookmarked"} as bookmarked,
|
||||
tags,
|
||||
input,
|
||||
output
|
||||
FROM traces FINAL
|
||||
${useAMT ? "finalizeAggregation(input)" : "input"} as input,
|
||||
${useAMT ? "finalizeAggregation(output)" : "output"} as output
|
||||
FROM ${traceTable} FINAL
|
||||
WHERE project_id = {projectId: String}
|
||||
AND timestamp >= {minTimestamp: DateTime64(3)}
|
||||
AND timestamp <= {maxTimestamp: DateTime64(3)}
|
||||
@@ -1781,6 +1789,7 @@ export const getTracesForBlobStorageExport = function (
|
||||
type: "trace",
|
||||
kind: "analytic",
|
||||
projectId,
|
||||
experiment_amt: useAMT ? "new" : "original",
|
||||
},
|
||||
clickhouseConfigs: {
|
||||
request_timeout: env.LANGFUSE_CLICKHOUSE_DATA_EXPORT_REQUEST_TIMEOUT_MS,
|
||||
@@ -1793,6 +1802,10 @@ export const getTracesForPostHog = async function* (
|
||||
minTimestamp: Date,
|
||||
maxTimestamp: Date,
|
||||
) {
|
||||
// Determine which trace table to use based on experiment flag
|
||||
const useAMT = env.LANGFUSE_EXPERIMENT_RETURN_NEW_RESULT === "true";
|
||||
const traceTable = useAMT ? getTimeframesTracesAMT(minTimestamp) : "traces";
|
||||
|
||||
const query = `
|
||||
WITH observations_agg AS (
|
||||
SELECT o.project_id,
|
||||
@@ -1820,7 +1833,7 @@ export const getTracesForPostHog = async function* (
|
||||
o.total_cost as total_cost,
|
||||
o.latency_milliseconds / 1000 as latency,
|
||||
o.observation_count as observation_count
|
||||
FROM traces t FINAL
|
||||
FROM ${traceTable} t FINAL
|
||||
LEFT JOIN observations_agg o ON t.id = o.trace_id AND t.project_id = o.project_id
|
||||
WHERE t.project_id = {projectId: String}
|
||||
AND t.timestamp >= {minTimestamp: DateTime64(3)}
|
||||
@@ -1839,6 +1852,7 @@ export const getTracesForPostHog = async function* (
|
||||
type: "trace",
|
||||
kind: "analytic",
|
||||
projectId,
|
||||
experiment_amt: useAMT ? "new" : "original",
|
||||
},
|
||||
clickhouseConfigs: {
|
||||
request_timeout: env.LANGFUSE_CLICKHOUSE_DATA_EXPORT_REQUEST_TIMEOUT_MS,
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
import { parseClickhouseUTCDateTimeFormat } from "./clickhouse";
|
||||
import { TraceRecordReadType } from "./definitions";
|
||||
import { convertDateToClickhouseDateTime } from "../clickhouse/client";
|
||||
import { parseJsonPrioritised } from "../../utils/json";
|
||||
import { TraceDomain } from "../../domain";
|
||||
import { parseMetadataCHRecordToDomain } from "../utils/metadata_conversion";
|
||||
import { env } from "../../env";
|
||||
import {
|
||||
RenderingProps,
|
||||
DEFAULT_RENDERING_PROPS,
|
||||
applyInputOutputRendering,
|
||||
} from "../utils/rendering";
|
||||
|
||||
export const convertTraceDomainToClickhouse = (
|
||||
trace: TraceDomain,
|
||||
@@ -34,7 +37,7 @@ export const convertTraceDomainToClickhouse = (
|
||||
|
||||
export const convertClickhouseToDomain = (
|
||||
record: TraceRecordReadType,
|
||||
truncated = false,
|
||||
renderingProps: RenderingProps = DEFAULT_RENDERING_PROPS,
|
||||
): TraceDomain => {
|
||||
return {
|
||||
id: record.id,
|
||||
@@ -49,18 +52,8 @@ export const convertClickhouseToDomain = (
|
||||
userId: record.user_id ?? null,
|
||||
sessionId: record.session_id ?? null,
|
||||
public: record.public,
|
||||
input: record.input
|
||||
? truncated &&
|
||||
record.input.length === env.LANGFUSE_SERVER_SIDE_IO_CHAR_LIMIT
|
||||
? (parseJsonPrioritised(record.input + "\n...[truncated]") ?? null)
|
||||
: (parseJsonPrioritised(record.input ?? null) ?? null)
|
||||
: null,
|
||||
output: record.output
|
||||
? truncated &&
|
||||
record.output.length === env.LANGFUSE_SERVER_SIDE_IO_CHAR_LIMIT
|
||||
? (parseJsonPrioritised(record.output + "\n...[truncated]") ?? null)
|
||||
: (parseJsonPrioritised(record.output ?? null) ?? null)
|
||||
: null,
|
||||
input: applyInputOutputRendering(record.input, renderingProps),
|
||||
output: applyInputOutputRendering(record.output, renderingProps),
|
||||
metadata: parseMetadataCHRecordToDomain(record.metadata),
|
||||
createdAt: parseClickhouseUTCDateTimeFormat(record.created_at),
|
||||
updatedAt: parseClickhouseUTCDateTimeFormat(record.updated_at),
|
||||
|
||||
@@ -35,6 +35,12 @@ export const HistogramChartConfig = BaseTotalValueChartConfig.extend({
|
||||
|
||||
export const PivotTableChartConfig = BaseTotalValueChartConfig.extend({
|
||||
type: z.literal("PIVOT_TABLE"),
|
||||
defaultSort: z
|
||||
.object({
|
||||
column: z.string(),
|
||||
order: z.enum(["ASC", "DESC"]),
|
||||
})
|
||||
.optional(),
|
||||
});
|
||||
|
||||
// Define dimension schema
|
||||
|
||||
+23
-1
@@ -1,7 +1,12 @@
|
||||
import z from "zod/v4";
|
||||
import { prisma } from "../../../db";
|
||||
import { LangfuseNotFoundError, QUEUE_ERROR_MESSAGES } from "../../../errors";
|
||||
import {
|
||||
ForbiddenError,
|
||||
LangfuseNotFoundError,
|
||||
QUEUE_ERROR_MESSAGES,
|
||||
} from "../../../errors";
|
||||
import { LLMApiKeySchema, ZodModelConfig } from "../../llm/types";
|
||||
import { testModelCall } from "../../llm/testModelCall";
|
||||
|
||||
type ValidConfig = {
|
||||
provider: string;
|
||||
@@ -47,6 +52,23 @@ export class DefaultEvalModelService {
|
||||
);
|
||||
}
|
||||
|
||||
try {
|
||||
if (LLMApiKeySchema.safeParse(llmApiKey).success) {
|
||||
// Make a test structured output call to validate the LLM key
|
||||
await testModelCall({
|
||||
provider,
|
||||
model,
|
||||
apiKey: llmApiKey as z.infer<typeof LLMApiKeySchema>,
|
||||
modelConfig: modelParams,
|
||||
});
|
||||
}
|
||||
} catch (err) {
|
||||
const message = err instanceof Error ? err.message : "Unknown error";
|
||||
throw new ForbiddenError(
|
||||
`Model configuration not valid for evaluation. ${message}`,
|
||||
);
|
||||
}
|
||||
|
||||
// Create or update the default model
|
||||
return prisma.defaultLlmModel.upsert({
|
||||
where: {
|
||||
|
||||
@@ -88,7 +88,7 @@ export function parseSlackInstallationMetadata(
|
||||
*/
|
||||
export class SlackService {
|
||||
private static instance: SlackService | null = null;
|
||||
private installer: InstallProvider;
|
||||
private readonly installer: InstallProvider;
|
||||
|
||||
private constructor() {
|
||||
this.installer = new InstallProvider({
|
||||
@@ -296,14 +296,20 @@ export class SlackService {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get channels accessible to the bot
|
||||
* Recursively fetch all channels accessible to the bot
|
||||
* Uses cursor-based pagination defined by Slack API https://api.slack.com/apis/pagination
|
||||
*/
|
||||
async getChannels(client: WebClient): Promise<SlackChannel[]> {
|
||||
private async getChannelsRecursive(
|
||||
client: WebClient,
|
||||
cursor?: string,
|
||||
fetchedRecords: number = 0,
|
||||
): Promise<SlackChannel[]> {
|
||||
try {
|
||||
const result = await client.conversations.list({
|
||||
exclude_archived: true,
|
||||
types: "public_channel",
|
||||
limit: 200,
|
||||
cursor: cursor,
|
||||
});
|
||||
|
||||
if (!result.ok) {
|
||||
@@ -319,6 +325,41 @@ export class SlackService {
|
||||
}),
|
||||
);
|
||||
|
||||
const nextCursor = result.response_metadata?.next_cursor;
|
||||
if (
|
||||
nextCursor &&
|
||||
fetchedRecords + channels.length < env.SLACK_FETCH_LIMIT
|
||||
) {
|
||||
try {
|
||||
const nextPageChannels = await this.getChannelsRecursive(
|
||||
client,
|
||||
nextCursor,
|
||||
fetchedRecords + channels.length,
|
||||
);
|
||||
return [...channels, ...nextPageChannels];
|
||||
} catch (error) {
|
||||
logger.error(
|
||||
`Failed to retrieve next page of channels, returning only already fetched`,
|
||||
error,
|
||||
);
|
||||
}
|
||||
}
|
||||
return channels;
|
||||
} catch (error) {
|
||||
logger.error("Failed to fetch channels recursively", { error, cursor });
|
||||
throw new Error(
|
||||
`Failed to fetch channels: ${error instanceof Error ? error.message : "Unknown error"}`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get channels accessible to the bot
|
||||
*/
|
||||
async getChannels(client: WebClient): Promise<SlackChannel[]> {
|
||||
try {
|
||||
const channels = await this.getChannelsRecursive(client);
|
||||
|
||||
logger.debug("Retrieved channels from Slack", {
|
||||
channelCount: channels.length,
|
||||
});
|
||||
|
||||
@@ -378,6 +378,11 @@ const getSessionsTableGeneric = async <T>(props: FetchSessionsTableProps) => {
|
||||
return measureAndReturn({
|
||||
operationName: "getSessionsTableGeneric",
|
||||
projectId,
|
||||
minStartTime: filter?.find(
|
||||
(f) =>
|
||||
f.column === "min_timestamp" &&
|
||||
(f.operator === ">=" || f.operator === ">"),
|
||||
)?.value as Date | undefined,
|
||||
input: {
|
||||
params: {
|
||||
projectId,
|
||||
|
||||
@@ -350,6 +350,7 @@ async function getTracesTableGeneric(props: FetchTracesTableProps) {
|
||||
return measureAndReturn({
|
||||
operationName: "getTracesTableGeneric",
|
||||
projectId: props.projectId,
|
||||
minStartTime: select !== "metrics" ? timeStampFilter?.value : undefined,
|
||||
input: props,
|
||||
existingExecution: async (props) => {
|
||||
let sqlSelect: string;
|
||||
|
||||
@@ -45,7 +45,7 @@ export const createDatasetRunItemsCh = async (
|
||||
datasetRunItems: DatasetRunItemRecordInsertType[],
|
||||
) => {
|
||||
return await clickhouseClient().insert({
|
||||
table: "dataset_run_items",
|
||||
table: "dataset_run_items_rmt",
|
||||
format: "JSONEachRow",
|
||||
values: datasetRunItems,
|
||||
});
|
||||
|
||||
@@ -15,6 +15,7 @@ export function createBasicAuthHeader(
|
||||
|
||||
export type CreateOrgProjectAndApiKeyOptions = {
|
||||
projectId?: string;
|
||||
plan?: "Team" | "Hobby" | "Core" | "Pro" | "Enterprise";
|
||||
};
|
||||
export const createOrgProjectAndApiKey = async (
|
||||
props?: CreateOrgProjectAndApiKeyOptions,
|
||||
@@ -25,7 +26,7 @@ export const createOrgProjectAndApiKey = async (
|
||||
id: v4(),
|
||||
name: v4(),
|
||||
cloudConfig: CloudConfigSchema.parse({
|
||||
plan: "Team",
|
||||
plan: props?.plan ?? "Team",
|
||||
}),
|
||||
},
|
||||
});
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
import { JsonNested } from "../../utils/zod";
|
||||
import { parseJsonPrioritised } from "../../utils/json";
|
||||
import { env } from "../../env";
|
||||
|
||||
/**
|
||||
* Rendering properties used to control how data is processed and returned
|
||||
* in tRPC routes and repository functions.
|
||||
*/
|
||||
export interface RenderingProps {
|
||||
/**
|
||||
* Whether to truncate input/output fields to a specific character limit
|
||||
*/
|
||||
truncated: boolean;
|
||||
|
||||
/**
|
||||
* Whether to skip JSON parsing of input/output fields and return them as raw strings.
|
||||
* This is useful when the client will handle JSON parsing to avoid double parsing.
|
||||
*/
|
||||
shouldJsonParse: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Default rendering properties
|
||||
*/
|
||||
export const DEFAULT_RENDERING_PROPS: RenderingProps = {
|
||||
truncated: false,
|
||||
shouldJsonParse: true,
|
||||
};
|
||||
|
||||
/**
|
||||
* Transform input/output fields based on rendering properties.
|
||||
*/
|
||||
export const applyInputOutputRendering = (
|
||||
io: string | null | undefined,
|
||||
renderingProps: RenderingProps,
|
||||
): JsonNested | string | null => {
|
||||
if (!io) return null;
|
||||
let result: JsonNested | string = io;
|
||||
|
||||
if (
|
||||
renderingProps.truncated &&
|
||||
io.length > env.LANGFUSE_SERVER_SIDE_IO_CHAR_LIMIT
|
||||
) {
|
||||
result =
|
||||
io.slice(0, env.LANGFUSE_SERVER_SIDE_IO_CHAR_LIMIT) + "\n...[truncated]";
|
||||
}
|
||||
|
||||
if (
|
||||
renderingProps.truncated &&
|
||||
io.length === env.LANGFUSE_SERVER_SIDE_IO_CHAR_LIMIT
|
||||
) {
|
||||
result = io + "\n...[truncated]";
|
||||
}
|
||||
|
||||
return renderingProps.shouldJsonParse
|
||||
? (parseJsonPrioritised(result) ?? null)
|
||||
: result;
|
||||
};
|
||||
@@ -1,28 +1,60 @@
|
||||
import { UiColumnMappings } from "./types";
|
||||
import { DatasetRunItemDomain } from "../domain/dataset-run-items";
|
||||
|
||||
export const datasetRunItemsTableUiColumnDefinitions: UiColumnMappings = [
|
||||
{
|
||||
uiTableName: "Dataset Run ID",
|
||||
uiTableId: "datasetRunId",
|
||||
clickhouseTableName: "dataset_run_items",
|
||||
clickhouseTableName: "dataset_run_items_rmt",
|
||||
clickhouseSelect: 'dri."dataset_run_id"',
|
||||
},
|
||||
{
|
||||
uiTableName: "Created At",
|
||||
uiTableId: "createdAt",
|
||||
clickhouseTableName: "dataset_run_items",
|
||||
clickhouseTableName: "dataset_run_items_rmt",
|
||||
clickhouseSelect: 'dri."created_at"',
|
||||
},
|
||||
{
|
||||
uiTableName: "Event Timestamp",
|
||||
uiTableId: "eventTs",
|
||||
clickhouseTableName: "dataset_run_items",
|
||||
clickhouseTableName: "dataset_run_items_rmt",
|
||||
clickhouseSelect: 'dri."event_ts"',
|
||||
},
|
||||
{
|
||||
uiTableName: "Dataset Item ID",
|
||||
uiTableId: "datasetItemId",
|
||||
clickhouseTableName: "dataset_run_items",
|
||||
clickhouseTableName: "dataset_run_items_rmt",
|
||||
clickhouseSelect: 'dri."dataset_item_id"',
|
||||
},
|
||||
{
|
||||
uiTableName: "Dataset",
|
||||
uiTableId: "datasetId",
|
||||
clickhouseTableName: "dataset_run_items_rmt",
|
||||
clickhouseSelect: 'dri."dataset_id"',
|
||||
},
|
||||
];
|
||||
|
||||
export const mapDatasetRunItemFilterColumn = (
|
||||
dataset: Pick<DatasetRunItemDomain, "id" | "datasetId">,
|
||||
column: string,
|
||||
): unknown => {
|
||||
const columnDef = datasetRunItemsTableUiColumnDefinitions.find(
|
||||
(col) =>
|
||||
col.uiTableId === column ||
|
||||
col.uiTableName === column ||
|
||||
col.clickhouseSelect === column,
|
||||
);
|
||||
if (!columnDef) {
|
||||
throw new Error(`Unhandled column for dataset run items filter: ${column}`);
|
||||
}
|
||||
switch (columnDef.uiTableId) {
|
||||
case "id":
|
||||
return dataset.id;
|
||||
case "datasetId":
|
||||
return dataset.datasetId;
|
||||
default:
|
||||
throw new Error(
|
||||
`Unhandled column in dataset run items filter mapping: ${column}`,
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -77,6 +77,7 @@ export const tableNames = [
|
||||
"job_configurations",
|
||||
"job_executions",
|
||||
"dataset_items",
|
||||
"annotation_queue_assignments",
|
||||
] as const;
|
||||
|
||||
export type TableNames = (typeof tableNames)[number];
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { InputJsonValue } from "@prisma/client/runtime/library";
|
||||
import { z } from "zod/v4";
|
||||
|
||||
// to be used for Prisma JSON type
|
||||
@@ -111,3 +112,26 @@ export const validateZodSchema = <T extends z.ZodTypeAny>(
|
||||
): z.infer<T> => {
|
||||
return schema.parse(object);
|
||||
};
|
||||
|
||||
// JSON Schema validation
|
||||
export const JSONPrimitiveValueSchema = z.union([
|
||||
z.string(),
|
||||
z.number().finite(),
|
||||
z.boolean(),
|
||||
]);
|
||||
|
||||
export const JSONValueSchema: z.ZodType<InputJsonValue> = z.lazy(() =>
|
||||
z.union([
|
||||
JSONPrimitiveValueSchema,
|
||||
z.array(JSONValueSchema),
|
||||
z.record(z.string(), JSONValueSchema),
|
||||
]),
|
||||
);
|
||||
|
||||
export const JSONObjectSchema = z.record(z.string(), JSONValueSchema);
|
||||
export const JSONArraySchema = z.array(JSONValueSchema);
|
||||
|
||||
export type JSONPrimitiveValue = z.infer<typeof JSONPrimitiveValueSchema>;
|
||||
export type JSONValue = z.infer<typeof JSONValueSchema>;
|
||||
export type JSONObject = z.infer<typeof JSONObjectSchema>;
|
||||
export type JSONArray = z.infer<typeof JSONArraySchema>;
|
||||
|
||||
Generated
+139
-204
@@ -9,6 +9,7 @@ overrides:
|
||||
katex: ^0.16.21
|
||||
tar-fs: ^2.1.2
|
||||
rollup@^4.0.0: ^4.22.4
|
||||
'@types/node-fetch': ^2.6.13
|
||||
|
||||
patchedDependencies:
|
||||
next-auth@4.24.11:
|
||||
@@ -38,8 +39,8 @@ importers:
|
||||
specifier: ^19.0.3
|
||||
version: 19.0.3(@types/node@20.14.8)
|
||||
turbo:
|
||||
specifier: ^2.5.5
|
||||
version: 2.5.5
|
||||
specifier: ^2.5.6
|
||||
version: 2.5.6
|
||||
|
||||
ee:
|
||||
dependencies:
|
||||
@@ -49,9 +50,6 @@ importers:
|
||||
'@opentelemetry/api':
|
||||
specifier: '>=1.0.0 <1.10.0'
|
||||
version: 1.9.0
|
||||
axios:
|
||||
specifier: ^1.8.2
|
||||
version: 1.8.2
|
||||
https-proxy-agent:
|
||||
specifier: ^7.0.6
|
||||
version: 7.0.6
|
||||
@@ -120,8 +118,8 @@ importers:
|
||||
specifier: ^9.1.0
|
||||
version: 9.1.0(eslint@8.57.0)
|
||||
eslint-config-turbo:
|
||||
specifier: ^2.5.5
|
||||
version: 2.5.5(eslint@8.57.0)(turbo@2.5.5)
|
||||
specifier: ^2.5.6
|
||||
version: 2.5.6(eslint@8.57.0)(turbo@2.5.6)
|
||||
eslint-plugin-only-warn:
|
||||
specifier: ^1.1.0
|
||||
version: 1.1.0
|
||||
@@ -152,8 +150,8 @@ importers:
|
||||
specifier: ^12.26.0
|
||||
version: 12.26.0
|
||||
'@clickhouse/client':
|
||||
specifier: ^1.12.0
|
||||
version: 1.12.0
|
||||
specifier: ^1.12.1
|
||||
version: 1.12.1
|
||||
'@google-cloud/storage':
|
||||
specifier: ^7.15.2
|
||||
version: 7.15.2
|
||||
@@ -188,17 +186,14 @@ importers:
|
||||
specifier: ^1.1.2
|
||||
version: 1.1.2(react-dom@18.2.0(react@18.2.0))(react@18.2.0)
|
||||
'@slack/oauth':
|
||||
specifier: ^2.6.0
|
||||
version: 2.6.3
|
||||
specifier: ^3.0.3
|
||||
version: 3.0.3
|
||||
'@slack/web-api':
|
||||
specifier: ^7.0.0
|
||||
specifier: ^7.9.3
|
||||
version: 7.9.3
|
||||
'@types/bcryptjs':
|
||||
specifier: ^2.4.6
|
||||
version: 2.4.6
|
||||
axios:
|
||||
specifier: ^1.8.2
|
||||
version: 1.8.2
|
||||
bcryptjs:
|
||||
specifier: ^2.4.3
|
||||
version: 2.4.3
|
||||
@@ -228,10 +223,10 @@ importers:
|
||||
version: 0.27.4
|
||||
langchain:
|
||||
specifier: ^0.3.28
|
||||
version: 0.3.28(@langchain/anthropic@0.3.22(@langchain/core@0.3.58(openai@4.104.0(zod@3.25.62))))(@langchain/aws@0.1.11(@langchain/core@0.3.58(openai@4.104.0(zod@3.25.62))))(@langchain/core@0.3.58(openai@4.104.0(zod@3.25.62)))(@langchain/google-genai@0.2.12(@langchain/core@0.3.58(openai@4.104.0(zod@3.25.62))))(@langchain/google-vertexai@0.2.12(@langchain/core@0.3.58(openai@4.104.0(zod@3.25.62)))(zod@3.25.62))(axios@1.8.2)(cheerio@1.0.0)(handlebars@4.7.8)(openai@4.104.0(zod@3.25.62))
|
||||
version: 0.3.28(@langchain/anthropic@0.3.22(@langchain/core@0.3.58(openai@4.104.0(zod@3.25.62))))(@langchain/aws@0.1.11(@langchain/core@0.3.58(openai@4.104.0(zod@3.25.62))))(@langchain/core@0.3.58(openai@4.104.0(zod@3.25.62)))(@langchain/google-genai@0.2.12(@langchain/core@0.3.58(openai@4.104.0(zod@3.25.62))))(@langchain/google-vertexai@0.2.12(@langchain/core@0.3.58(openai@4.104.0(zod@3.25.62)))(zod@3.25.62))(axios@1.11.0)(cheerio@1.0.0)(handlebars@4.7.8)(openai@4.104.0(zod@3.25.62))
|
||||
langfuse-langchain:
|
||||
specifier: 3.38.4
|
||||
version: 3.38.4(langchain@0.3.28(@langchain/anthropic@0.3.22(@langchain/core@0.3.58(openai@4.104.0(zod@3.25.62))))(@langchain/aws@0.1.11(@langchain/core@0.3.58(openai@4.104.0(zod@3.25.62))))(@langchain/core@0.3.58(openai@4.104.0(zod@3.25.62)))(@langchain/google-genai@0.2.12(@langchain/core@0.3.58(openai@4.104.0(zod@3.25.62))))(@langchain/google-vertexai@0.2.12(@langchain/core@0.3.58(openai@4.104.0(zod@3.25.62)))(zod@3.25.62))(axios@1.8.2)(cheerio@1.0.0)(handlebars@4.7.8)(openai@4.104.0(zod@3.25.62)))
|
||||
version: 3.38.4(langchain@0.3.28(@langchain/anthropic@0.3.22(@langchain/core@0.3.58(openai@4.104.0(zod@3.25.62))))(@langchain/aws@0.1.11(@langchain/core@0.3.58(openai@4.104.0(zod@3.25.62))))(@langchain/core@0.3.58(openai@4.104.0(zod@3.25.62)))(@langchain/google-genai@0.2.12(@langchain/core@0.3.58(openai@4.104.0(zod@3.25.62))))(@langchain/google-vertexai@0.2.12(@langchain/core@0.3.58(openai@4.104.0(zod@3.25.62)))(zod@3.25.62))(axios@1.11.0)(cheerio@1.0.0)(handlebars@4.7.8)(openai@4.104.0(zod@3.25.62)))
|
||||
lodash:
|
||||
specifier: ^4.17.21
|
||||
version: 4.17.21
|
||||
@@ -518,12 +513,6 @@ importers:
|
||||
'@sentry/nextjs':
|
||||
specifier: ^8.52.0
|
||||
version: 8.55.0(@opentelemetry/context-async-hooks@1.30.1(@opentelemetry/api@1.9.0))(@opentelemetry/core@1.26.0(@opentelemetry/api@1.9.0))(@opentelemetry/instrumentation@0.53.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@1.26.0(@opentelemetry/api@1.9.0))(next@14.2.30(@babel/core@7.24.3)(@opentelemetry/api@1.9.0)(@playwright/test@1.47.2)(babel-plugin-macros@3.1.0)(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(react@18.2.0)(webpack@5.97.1)
|
||||
'@slack/oauth':
|
||||
specifier: ^2.6.0
|
||||
version: 2.6.3
|
||||
'@slack/web-api':
|
||||
specifier: ^7.0.0
|
||||
version: 7.9.3
|
||||
'@t3-oss/env-nextjs':
|
||||
specifier: ^0.11.1
|
||||
version: 0.11.1(typescript@5.4.5)(zod@3.25.62)
|
||||
@@ -912,9 +901,6 @@ importers:
|
||||
'@prisma/instrumentation':
|
||||
specifier: ^6.3.0
|
||||
version: 6.3.0(@opentelemetry/api@1.9.0)
|
||||
'@slack/web-api':
|
||||
specifier: ^7.0.0
|
||||
version: 7.9.3
|
||||
backoff:
|
||||
specifier: ^2.5.0
|
||||
version: 2.5.0
|
||||
@@ -1799,11 +1785,11 @@ packages:
|
||||
'@chevrotain/utils@11.0.3':
|
||||
resolution: {integrity: sha512-YslZMgtJUyuMbZ+aKvfF3x1f5liK4mWNxghFRv7jqRR9C3R3fAOGTTKvxXDa2Y1s9zSbcpuO0cAxDYsc9SrXoQ==}
|
||||
|
||||
'@clickhouse/client-common@1.12.0':
|
||||
resolution: {integrity: sha512-cyI4n7u9jK30d9q1q0ceQ7IwJ/MtTs5HxoQfc8yHpN+ok5wqaU2jAtq5hpa1z7C7sS1pDy/ZOFmOzg1v1F683g==}
|
||||
'@clickhouse/client-common@1.12.1':
|
||||
resolution: {integrity: sha512-ccw1N6hB4+MyaAHIaWBwGZ6O2GgMlO99FlMj0B0UEGfjxM9v5dYVYql6FpP19rMwrVAroYs/IgX2vyZEBvzQLg==}
|
||||
|
||||
'@clickhouse/client@1.12.0':
|
||||
resolution: {integrity: sha512-vJUSX8THhTzlVn0WxPukVjOgNRaSoY02ubQkB0LpqNoHFxXuF5jQZZAYvGZWpBGbYQ/4gfPrqu8g4TX5UKeNxA==}
|
||||
'@clickhouse/client@1.12.1':
|
||||
resolution: {integrity: sha512-7ORY85rphRazqHzImNXMrh4vsaPrpetFoTWpZYueCO2bbO6PXYDXp/GQ4DgxnGIqbWB/Di1Ai+Xuwq2o7DJ36A==}
|
||||
engines: {node: '>=16'}
|
||||
|
||||
'@codemirror/autocomplete@6.17.0':
|
||||
@@ -2304,6 +2290,9 @@ packages:
|
||||
'@floating-ui/core@1.7.2':
|
||||
resolution: {integrity: sha512-wNB5ooIKHQc+Kui96jE/n69rHFWAVoxn5CAzL1Xdd8FG03cgY3MLO+GF9U3W737fYDSgPWA6MReKhBQBop6Pcw==}
|
||||
|
||||
'@floating-ui/core@1.7.3':
|
||||
resolution: {integrity: sha512-sGnvb5dmrJaKEZ+LDIpguvdX3bDlEllmv4/ClQ9awcmCZrlx5jQyyMWFM5kBI+EyNOCDDiKk8il0zeuX3Zlg/w==}
|
||||
|
||||
'@floating-ui/dom@1.6.11':
|
||||
resolution: {integrity: sha512-qkMCxSR24v2vGkhYDo/UzxfJN3D4syqSjyuTFz6C7XcpU1pASPRieNI0Kj5VP3/503mOfYiGY891ugBX1GlABQ==}
|
||||
|
||||
@@ -2313,6 +2302,9 @@ packages:
|
||||
'@floating-ui/dom@1.7.2':
|
||||
resolution: {integrity: sha512-7cfaOQuCS27HD7DX+6ib2OrnW+b4ZBwDNnCcT0uTyidcmyWb03FnQqJybDBoCnpdxwBSfA94UAYlRCt7mV+TbA==}
|
||||
|
||||
'@floating-ui/dom@1.7.3':
|
||||
resolution: {integrity: sha512-uZA413QEpNuhtb3/iIKoYMSK07keHPYeXF02Zhd6e213j+d1NamLix/mCLxBUDW/Gx52sPH2m+chlUsyaBs/Ag==}
|
||||
|
||||
'@floating-ui/react-dom@1.3.0':
|
||||
resolution: {integrity: sha512-htwHm67Ji5E/pROEAr7f8IKFShuiCKHwUC/UY4vC3I5jiSvGFAYnSYiZO5MlGmads+QqvUkR9ANHEguGrDv72g==}
|
||||
peerDependencies:
|
||||
@@ -2331,6 +2323,12 @@ packages:
|
||||
react: '>=16.8.0'
|
||||
react-dom: '>=16.8.0'
|
||||
|
||||
'@floating-ui/react-dom@2.1.5':
|
||||
resolution: {integrity: sha512-HDO/1/1oH9fjj4eLgegrlH3dklZpHtUYYFiVwMUwfGvk9jWDRWqkklA2/NFScknrcNSspbV868WjXORvreDX+Q==}
|
||||
peerDependencies:
|
||||
react: '>=16.8.0'
|
||||
react-dom: '>=16.8.0'
|
||||
|
||||
'@floating-ui/react@0.19.2':
|
||||
resolution: {integrity: sha512-JyNk4A0Ezirq8FlXECvRtQOX/iBe5Ize0W/pLkrZjfHW9GUV7Xnq6zm6fyZuQzaHHqEnVizmvlA96e1/CkZv+w==}
|
||||
peerDependencies:
|
||||
@@ -2937,8 +2935,8 @@ packages:
|
||||
'@types/react':
|
||||
optional: true
|
||||
|
||||
'@mui/types@7.4.4':
|
||||
resolution: {integrity: sha512-p63yhbX52MO/ajXC7hDHJA5yjzJekvWD3q4YDLl1rSg+OXLczMYPvTuSuviPRCgRX8+E42RXz1D/dz9SxPSlWg==}
|
||||
'@mui/types@7.4.5':
|
||||
resolution: {integrity: sha512-ZPwlAOE3e8C0piCKbaabwrqZbW4QvWz0uapVPWya7fYj6PeDkl5sSJmomT7wjOcZGPB48G/a6Ubidqreptxz4g==}
|
||||
peerDependencies:
|
||||
'@types/react': ^17.0.0 || ^18.0.0 || ^19.0.0
|
||||
peerDependenciesMeta:
|
||||
@@ -4697,26 +4695,18 @@ packages:
|
||||
'@sinonjs/fake-timers@10.3.0':
|
||||
resolution: {integrity: sha512-V4BG07kuYSUkTCSBHG8G8TNhM+F19jXFWnQtzj+we8DrkpSBCee9Z3Ms8yiGer/dlmhe35/Xdgyo3/0rQKg7YA==}
|
||||
|
||||
'@slack/logger@3.0.0':
|
||||
resolution: {integrity: sha512-DTuBFbqu4gGfajREEMrkq5jBhcnskinhr4+AnfJEk48zhVeEv3XnUKGIX98B74kxhYsIMfApGGySTn7V3b5yBA==}
|
||||
engines: {node: '>= 12.13.0', npm: '>= 6.12.0'}
|
||||
|
||||
'@slack/logger@4.0.0':
|
||||
resolution: {integrity: sha512-Wz7QYfPAlG/DR+DfABddUZeNgoeY7d1J39OCR2jR+v7VBsB8ezulDK5szTnDDPDwLH5IWhLvXIHlCFZV7MSKgA==}
|
||||
engines: {node: '>= 18', npm: '>= 8.6.0'}
|
||||
|
||||
'@slack/oauth@2.6.3':
|
||||
resolution: {integrity: sha512-1amXs6xRkJpoH6zSgjVPgGEJXCibKNff9WNDijcejIuVy1HFAl1adh7lehaGNiHhTWfQkfKxBiF+BGn56kvoFw==}
|
||||
engines: {node: '>=12.13.0', npm: '>=6.12.0'}
|
||||
'@slack/oauth@3.0.3':
|
||||
resolution: {integrity: sha512-N3pLJPacZ57bqmD1HzHDmHe/CNsL9pESZXRw7pfv6QXJVRgufPIW84aRpAez2Xb0616RpGBYZW5dZH0Nbskwyg==}
|
||||
engines: {node: '>=18', npm: '>=8.6.0'}
|
||||
|
||||
'@slack/types@2.15.0':
|
||||
resolution: {integrity: sha512-livb1gyG3J8ATLBJ3KjZfjHpTRz9btY1m5cgNuXxWJbhwRB1Gwb8Ly6XLJm2Sy1W6h+vLgqIHg7IwKrF1C1Szg==}
|
||||
engines: {node: '>= 12.13.0', npm: '>= 6.12.0'}
|
||||
|
||||
'@slack/web-api@6.13.0':
|
||||
resolution: {integrity: sha512-dv65crIgdh9ZYHrevLU6XFHTQwTyDmNqEqzuIrV+Vqe/vgiG6w37oex5ePDU1RGm2IJ90H8iOvHFvzdEO/vB+g==}
|
||||
engines: {node: '>= 12.13.0', npm: '>= 6.12.0'}
|
||||
|
||||
'@slack/web-api@7.9.3':
|
||||
resolution: {integrity: sha512-xjnoldVJyoUe61Ltqjr2UVYBolcsTpp5ottqzSI3l41UCaJgHSHIOpGuYps+nhLFvDfGGpDGUeQ7BWiq3+ypqA==}
|
||||
engines: {node: '>= 18', npm: '>= 8.6.0'}
|
||||
@@ -5400,9 +5390,6 @@ packages:
|
||||
'@types/http-errors@2.0.5':
|
||||
resolution: {integrity: sha512-r8Tayk8HJnX0FztbZN7oVqGccWgw98T/0neJphO91KkmOzug1KkofZURD4UaD5uH8AqcFLfdPErnBod0u71/qg==}
|
||||
|
||||
'@types/is-stream@1.1.0':
|
||||
resolution: {integrity: sha512-jkZatu4QVbR60mpIzjINmtS1ZF4a/FqdTUTBeQDVOQ2PYyidtwFKr0B5G6ERukKwliq+7mIXvxyppwzG5EgRYg==}
|
||||
|
||||
'@types/istanbul-lib-coverage@2.0.6':
|
||||
resolution: {integrity: sha512-2QF/t/auWm0lsy8XtKVPG19v3sSOQlJe/YHZgfjb/KBBHOGSV+J2q/S671rcq9uTBrLAXmZpqJiaQbMT+zNU1w==}
|
||||
|
||||
@@ -5424,8 +5411,8 @@ packages:
|
||||
'@types/json5@0.0.29':
|
||||
resolution: {integrity: sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==}
|
||||
|
||||
'@types/jsonwebtoken@8.5.9':
|
||||
resolution: {integrity: sha512-272FMnFGzAVMGtu9tkr29hRL6bZj4Zs1KZNeHLnKqAvp06tAIcarTMwOh8/8bz4FmKRcMxZhZNeUAQsNLoiPhg==}
|
||||
'@types/jsonwebtoken@9.0.10':
|
||||
resolution: {integrity: sha512-asx5hIG9Qmf/1oStypjanR7iKTv0gXQ1Ov/jfrX6kS/EO0OFni8orbmGCn0672NHR3kXHwpAwR+B368ZGN/2rA==}
|
||||
|
||||
'@types/katex@0.16.7':
|
||||
resolution: {integrity: sha512-HMwFiRujE5PjrgwHQ25+bsLJgowjGjm5Z8FVSf0N6PwgJrwxH0QxzHYDcKsTfV3wva0vzrpqMTJS2jXPr5BMEQ==}
|
||||
@@ -5439,14 +5426,14 @@ packages:
|
||||
'@types/mime@1.3.5':
|
||||
resolution: {integrity: sha512-/pyBZWSLD2n0dcHE3hq8s8ZvcETHtEuF+3E7XVt0Ig2nvsVQXdghHVcEkIWjy9A0wKfTn97a/PSDYohKIlnP/w==}
|
||||
|
||||
'@types/ms@0.7.34':
|
||||
resolution: {integrity: sha512-nG96G3Wp6acyAgJqGasjODb+acrI7KltPiRxzHPXnP3NgI28bpQDRv53olbqGXbfcgF5aiiHmO3xpwEpS5Ld9g==}
|
||||
'@types/ms@2.1.0':
|
||||
resolution: {integrity: sha512-GsCCIZDE/p3i96vtEqx+7dBUGXrc7zeSK3wwPHIaRThS+9OhWIXRqzs4d6k1SVU8g91DrNRWxWUGhp5KXQb2VA==}
|
||||
|
||||
'@types/mysql@2.15.26':
|
||||
resolution: {integrity: sha512-DSLCOXhkvfS5WNNPbfn2KdICAmk8lLc+/PNvnPnF7gOdMZCxopXduqv0OQ13y/yA/zXTSikZZqVgybUxOEg6YQ==}
|
||||
|
||||
'@types/node-fetch@2.6.12':
|
||||
resolution: {integrity: sha512-8nneRWKCg3rMtF69nLQJnOYUcbafYeFSjqkw3jCRLsqkWFlHaoQrr5mXmofFGOx3DKn7UfmBMyov8ySvLRVldA==}
|
||||
'@types/node-fetch@2.6.13':
|
||||
resolution: {integrity: sha512-QGpRVpzSaUs30JBSGPjOg4Uveu384erbHBoT1zeONvyCfwQxIkUshLAOqN/k9EjGviPRmWTTe6aH2qySWKTVSw==}
|
||||
|
||||
'@types/node@18.19.120':
|
||||
resolution: {integrity: sha512-WtCGHFXnVI8WHLxDAt5TbnCM4eSE+nI0QN2NJtwzcgMhht2eNz6V9evJrk+lwC8bCY8OWV5Ym8Jz7ZEyGnKnMA==}
|
||||
@@ -6352,8 +6339,8 @@ packages:
|
||||
caniuse-lite@1.0.30001723:
|
||||
resolution: {integrity: sha512-1R/elMjtehrFejxwmexeXAtae5UO9iSyFn6G/I806CYC/BLyyBk1EPhrKBkWhy6wM6Xnm47dSJQec+tLJ39WHw==}
|
||||
|
||||
caniuse-lite@1.0.30001727:
|
||||
resolution: {integrity: sha512-pB68nIHmbN6L/4C6MH1DokyR3bYqFwjaSs/sWDHGj4CTcFtQUQMuJftVwWkXq7mNWOybD3KhUv3oWHoGxgP14Q==}
|
||||
caniuse-lite@1.0.30001733:
|
||||
resolution: {integrity: sha512-e4QKw/O2Kavj2VQTKZWrwzkt3IxOmIlU6ajRb6LP64LHpBo1J67k2Hi4Vu/TgJWsNtynurfS0uK3MaUTCPfu5Q==}
|
||||
|
||||
ccount@2.0.1:
|
||||
resolution: {integrity: sha512-eyrF0jiFpY+3drT6383f1qhkbGsLSifNAjA61IUjZjmLCWjItY6LB9ft9YhoDgwfmclB2zhu51Lc7+95b8NRAg==}
|
||||
@@ -7212,10 +7199,6 @@ packages:
|
||||
resolution: {integrity: sha512-ZmdL2rui+eB2YwhsWzjInR8LldtZHGDoQ1ugH85ppHKwpUHL7j7rN0Ti9NCnGiQbhaZ11FpR+7ao1dNsmduNUg==}
|
||||
engines: {node: '>=12'}
|
||||
|
||||
dotenv@16.5.0:
|
||||
resolution: {integrity: sha512-m/C+AwOAr9/W1UOIZUo232ejMNnJAJtYQjUbHoNTBNTJSvqzzDh7vnrei3o3r3m9blf6ZoDkvcw0VmozNRFJxg==}
|
||||
engines: {node: '>=12'}
|
||||
|
||||
dotenv@16.6.1:
|
||||
resolution: {integrity: sha512-uBq4egWHTcTt33a72vpSG0z3HnPuIl6NqYcTrKEg2azoEyl2hpW0zqlxysq2pK9HlDIHyHyakeYaYnSAwd8bow==}
|
||||
engines: {node: '>=12'}
|
||||
@@ -7245,8 +7228,8 @@ packages:
|
||||
electron-to-chromium@1.5.167:
|
||||
resolution: {integrity: sha512-LxcRvnYO5ez2bMOFpbuuVuAI5QNeY1ncVytE/KXaL6ZNfzX1yPlAO0nSOyIHx2fVAuUprMqPs/TdVhUFZy7SIQ==}
|
||||
|
||||
electron-to-chromium@1.5.192:
|
||||
resolution: {integrity: sha512-rP8Ez0w7UNw/9j5eSXCe10o1g/8B1P5SM90PCCMVkIRQn2R0LEHWz4Eh9RnxkniuDe1W0cTSOB3MLlkTGDcuCg==}
|
||||
electron-to-chromium@1.5.199:
|
||||
resolution: {integrity: sha512-3gl0S7zQd88kCAZRO/DnxtBKuhMO4h0EaQIN3YgZfV6+pW+5+bf2AdQeHNESCoaQqo/gjGVYEf2YM4O5HJQqpQ==}
|
||||
|
||||
electron-to-chromium@1.5.33:
|
||||
resolution: {integrity: sha512-+cYTcFB1QqD4j4LegwLfpCNxifb6dDFUAwk6RsLusCwIaZI6or2f+q8rs5tTB2YC53HhOlIbEaqHMAAC8IOIwA==}
|
||||
@@ -7281,8 +7264,8 @@ packages:
|
||||
resolution: {integrity: sha512-LMHl3dXhTcfv8gM4kEzIUeTQ+7fpdA0l2tUf34BddXPkz2A5xJ5L/Pchd5BL6rdccM9QGvu0sWZzK1Z1t4wwyg==}
|
||||
engines: {node: '>=10.13.0'}
|
||||
|
||||
enhanced-resolve@5.18.2:
|
||||
resolution: {integrity: sha512-6Jw4sE1maoRJo3q8MsSIn2onJFbLTOjY9hlx4DZXmOKvLRd1Ok2kXmAGXaafL2+ijsJZ1ClYbl/pmqr9+k4iUQ==}
|
||||
enhanced-resolve@5.18.3:
|
||||
resolution: {integrity: sha512-d4lC8xfavMeBjzGr2vECC3fsGXziXZQyJxD868h2M/mBI3PwAuODxAkLkq5HYuvrPYcUtiLzsTo8U3PgX3Ocww==}
|
||||
engines: {node: '>=10.13.0'}
|
||||
|
||||
entities@4.5.0:
|
||||
@@ -7406,8 +7389,8 @@ packages:
|
||||
eslint-plugin-n: '^15.0.0 || ^16.0.0 '
|
||||
eslint-plugin-promise: ^6.0.0
|
||||
|
||||
eslint-config-turbo@2.5.5:
|
||||
resolution: {integrity: sha512-23lKrCr66HQR62aa94n2dBGUUFz0GzM6N1KwmcREZHxomZ5Ik2rDm00wAz95lOEkhzSt6IaxW00Uz0az/Fcq5Q==}
|
||||
eslint-config-turbo@2.5.6:
|
||||
resolution: {integrity: sha512-1EV/UqdKE75st9q6y0MCxz7qp2v7RyGvbQsMLSuCz+VH8ScnSfmhd8FcAbqx3BshCy5IluujzMB6T5iCgL3/sA==}
|
||||
peerDependencies:
|
||||
eslint: '>6.6.0'
|
||||
turbo: '>2.0.0'
|
||||
@@ -7551,8 +7534,8 @@ packages:
|
||||
eslint-plugin-tsdoc@0.2.17:
|
||||
resolution: {integrity: sha512-xRmVi7Zx44lOBuYqG8vzTXuL6IdGOeF9nHX17bjJ8+VE6fsxpdGem0/SBTmAwgYMKYB1WBkqRJVQ+n8GK041pA==}
|
||||
|
||||
eslint-plugin-turbo@2.5.5:
|
||||
resolution: {integrity: sha512-IlN65X6W7rgK88u5xl1xC+7FIGKA7eyaca0yxZQ9CBNV6keAaqtjZQLw8ZfXdv7T+MzTLYkYOeOHAv8yCRUx4Q==}
|
||||
eslint-plugin-turbo@2.5.6:
|
||||
resolution: {integrity: sha512-KUDE23aP2JV8zbfZ4TeM1HpAXzMM/AYG/bJam7P4AalUxas8Pd/lS/6R3p4uX91qJcH1LwL4h0ED48nDe8KorQ==}
|
||||
peerDependencies:
|
||||
eslint: '>6.6.0'
|
||||
turbo: '>2.0.0'
|
||||
@@ -7651,9 +7634,6 @@ packages:
|
||||
resolution: {integrity: sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==}
|
||||
engines: {node: '>=6'}
|
||||
|
||||
eventemitter3@3.1.2:
|
||||
resolution: {integrity: sha512-tvtQIeLVHjDkJYnzf2dgVMxfuSGJeM/7UCG17TT4EumTfNtF+0nebF/4zWOIkCreAbtNqhGEboB6BWrwqNaw4Q==}
|
||||
|
||||
eventemitter3@4.0.7:
|
||||
resolution: {integrity: sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==}
|
||||
|
||||
@@ -8515,10 +8495,6 @@ packages:
|
||||
is-ssh@1.4.1:
|
||||
resolution: {integrity: sha512-JNeu1wQsHjyHgn9NcWTaXq6zWSR6hqE0++zhfZlkFBbScNkyvxCdeV8sRkSBaeLKxmbpR21brail63ACNxJ0Tg==}
|
||||
|
||||
is-stream@1.1.0:
|
||||
resolution: {integrity: sha512-uQPm8kcs47jx38atAcWTVxyltQYoPT68y9aWYdV6yWXSyW8mzSat0TL6CiWdZeCdF3KrAvpVtnHbTv4RN+rqdQ==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
|
||||
is-stream@2.0.1:
|
||||
resolution: {integrity: sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==}
|
||||
engines: {node: '>=8'}
|
||||
@@ -10479,7 +10455,7 @@ packages:
|
||||
|
||||
puppeteer@19.11.1:
|
||||
resolution: {integrity: sha512-39olGaX2djYUdhaQQHDZ0T0GwEp+5f9UB9HmEP0qHfdQHIq0xGQZuAZ5TLnJIc/88SrPLpEflPC+xUqOTv3c5g==}
|
||||
deprecated: < 22.8.2 is no longer supported
|
||||
deprecated: < 24.9.0 is no longer supported
|
||||
|
||||
pure-rand@6.0.4:
|
||||
resolution: {integrity: sha512-LA0Y9kxMYv47GIPJy6MI84fqTd2HmYZI83W/kM/SkKfDlajnZYfmXFTxkbY+xSBPkLJxltMa9hIkmdc29eguMA==}
|
||||
@@ -11607,38 +11583,38 @@ packages:
|
||||
ttl-set@1.0.0:
|
||||
resolution: {integrity: sha512-2fuHn/UR+8Z9HK49r97+p2Ru1b5Eewg2QqPrU14BVCQ9QoyU3+vLLZk2WEiyZ9sgJh6W8G1cZr9I2NBLywAHrA==}
|
||||
|
||||
turbo-darwin-64@2.5.5:
|
||||
resolution: {integrity: sha512-RYnTz49u4F5tDD2SUwwtlynABNBAfbyT2uU/brJcyh5k6lDLyNfYKdKmqd3K2ls4AaiALWrFKVSBsiVwhdFNzQ==}
|
||||
turbo-darwin-64@2.5.6:
|
||||
resolution: {integrity: sha512-3C1xEdo4aFwMJAPvtlPqz1Sw/+cddWIOmsalHFMrsqqydcptwBfu26WW2cDm3u93bUzMbBJ8k3zNKFqxJ9ei2A==}
|
||||
cpu: [x64]
|
||||
os: [darwin]
|
||||
|
||||
turbo-darwin-arm64@2.5.5:
|
||||
resolution: {integrity: sha512-Tk+ZeSNdBobZiMw9aFypQt0DlLsWSFWu1ymqsAdJLuPoAH05qCfYtRxE1pJuYHcJB5pqI+/HOxtJoQ40726Btw==}
|
||||
turbo-darwin-arm64@2.5.6:
|
||||
resolution: {integrity: sha512-LyiG+rD7JhMfYwLqB6k3LZQtYn8CQQUePbpA8mF/hMLPAekXdJo1g0bUPw8RZLwQXUIU/3BU7tXENvhSGz5DPA==}
|
||||
cpu: [arm64]
|
||||
os: [darwin]
|
||||
|
||||
turbo-linux-64@2.5.5:
|
||||
resolution: {integrity: sha512-2/XvMGykD7VgsvWesZZYIIVXMlgBcQy+ZAryjugoTcvJv8TZzSU/B1nShcA7IAjZ0q7OsZ45uP2cOb8EgKT30w==}
|
||||
turbo-linux-64@2.5.6:
|
||||
resolution: {integrity: sha512-GOcUTT0xiT/pSnHL4YD6Yr3HreUhU8pUcGqcI2ksIF9b2/r/kRHwGFcsHgpG3+vtZF/kwsP0MV8FTlTObxsYIA==}
|
||||
cpu: [x64]
|
||||
os: [linux]
|
||||
|
||||
turbo-linux-arm64@2.5.5:
|
||||
resolution: {integrity: sha512-DW+8CjCjybu0d7TFm9dovTTVg1VRnlkZ1rceO4zqsaLrit3DgHnN4to4uwyuf9s2V/BwS3IYcRy+HG9BL596Iw==}
|
||||
turbo-linux-arm64@2.5.6:
|
||||
resolution: {integrity: sha512-10Tm15bruJEA3m0V7iZcnQBpObGBcOgUcO+sY7/2vk1bweW34LMhkWi8svjV9iDF68+KJDThnYDlYE/bc7/zzQ==}
|
||||
cpu: [arm64]
|
||||
os: [linux]
|
||||
|
||||
turbo-windows-64@2.5.5:
|
||||
resolution: {integrity: sha512-q5p1BOy8ChtSZfULuF1BhFMYIx6bevXu4fJ+TE/hyNfyHJIfjl90Z6jWdqAlyaFLmn99X/uw+7d6T/Y/dr5JwQ==}
|
||||
turbo-windows-64@2.5.6:
|
||||
resolution: {integrity: sha512-FyRsVpgaj76It0ludwZsNN40ytHN+17E4PFJyeliBEbxrGTc5BexlXVpufB7XlAaoaZVxbS6KT8RofLfDRyEPg==}
|
||||
cpu: [x64]
|
||||
os: [win32]
|
||||
|
||||
turbo-windows-arm64@2.5.5:
|
||||
resolution: {integrity: sha512-AXbF1KmpHUq3PKQwddMGoKMYhHsy5t1YBQO8HZ04HLMR0rWv9adYlQ8kaeQJTko1Ay1anOBFTqaxfVOOsu7+1Q==}
|
||||
turbo-windows-arm64@2.5.6:
|
||||
resolution: {integrity: sha512-j/tWu8cMeQ7HPpKri6jvKtyXg9K1gRyhdK4tKrrchH8GNHscPX/F71zax58yYtLRWTiK04zNzPcUJuoS0+v/+Q==}
|
||||
cpu: [arm64]
|
||||
os: [win32]
|
||||
|
||||
turbo@2.5.5:
|
||||
resolution: {integrity: sha512-eZ7wI6KjtT1eBqCnh2JPXWNUAxtoxxfi6VdBdZFvil0ychCOTxbm7YLRBi1JSt7U3c+u3CLxpoPxLdvr/Npr3A==}
|
||||
turbo@2.5.6:
|
||||
resolution: {integrity: sha512-gxToHmi9oTBNB05UjUsrWf0OyN5ZXtD0apOarC1KIx232Vp3WimRNy3810QzeNSgyD5rsaIDXlxlbnOzlouo+w==}
|
||||
hasBin: true
|
||||
|
||||
type-check@0.4.0:
|
||||
@@ -12376,7 +12352,7 @@ snapshots:
|
||||
'@anthropic-ai/sdk@0.39.0':
|
||||
dependencies:
|
||||
'@types/node': 18.19.120
|
||||
'@types/node-fetch': 2.6.12
|
||||
'@types/node-fetch': 2.6.13
|
||||
abort-controller: 3.0.0
|
||||
agentkeepalive: 4.6.0
|
||||
form-data-encoder: 1.7.2
|
||||
@@ -13906,11 +13882,11 @@ snapshots:
|
||||
|
||||
'@chevrotain/utils@11.0.3': {}
|
||||
|
||||
'@clickhouse/client-common@1.12.0': {}
|
||||
'@clickhouse/client-common@1.12.1': {}
|
||||
|
||||
'@clickhouse/client@1.12.0':
|
||||
'@clickhouse/client@1.12.1':
|
||||
dependencies:
|
||||
'@clickhouse/client-common': 1.12.0
|
||||
'@clickhouse/client-common': 1.12.1
|
||||
|
||||
'@codemirror/autocomplete@6.17.0(@codemirror/language@6.11.2)(@codemirror/state@6.5.2)(@codemirror/view@6.38.1)(@lezer/common@1.2.3)':
|
||||
dependencies:
|
||||
@@ -14333,6 +14309,10 @@ snapshots:
|
||||
dependencies:
|
||||
'@floating-ui/utils': 0.2.10
|
||||
|
||||
'@floating-ui/core@1.7.3':
|
||||
dependencies:
|
||||
'@floating-ui/utils': 0.2.10
|
||||
|
||||
'@floating-ui/dom@1.6.11':
|
||||
dependencies:
|
||||
'@floating-ui/core': 1.6.8
|
||||
@@ -14348,6 +14328,11 @@ snapshots:
|
||||
'@floating-ui/core': 1.7.2
|
||||
'@floating-ui/utils': 0.2.10
|
||||
|
||||
'@floating-ui/dom@1.7.3':
|
||||
dependencies:
|
||||
'@floating-ui/core': 1.7.3
|
||||
'@floating-ui/utils': 0.2.10
|
||||
|
||||
'@floating-ui/react-dom@1.3.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0)':
|
||||
dependencies:
|
||||
'@floating-ui/dom': 1.6.3
|
||||
@@ -14366,6 +14351,12 @@ snapshots:
|
||||
react: 18.2.0
|
||||
react-dom: 18.2.0(react@18.2.0)
|
||||
|
||||
'@floating-ui/react-dom@2.1.5(react-dom@18.2.0(react@18.2.0))(react@18.2.0)':
|
||||
dependencies:
|
||||
'@floating-ui/dom': 1.7.3
|
||||
react: 18.2.0
|
||||
react-dom: 18.2.0(react@18.2.0)
|
||||
|
||||
'@floating-ui/react@0.19.2(react-dom@18.2.0(react@18.2.0))(react@18.2.0)':
|
||||
dependencies:
|
||||
'@floating-ui/react-dom': 1.3.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0)
|
||||
@@ -14665,7 +14656,7 @@ snapshots:
|
||||
'@jest/console@29.7.0':
|
||||
dependencies:
|
||||
'@jest/types': 29.6.3
|
||||
'@types/node': 20.11.29
|
||||
'@types/node': 20.14.8
|
||||
chalk: 4.1.2
|
||||
jest-message-util: 29.7.0
|
||||
jest-util: 29.7.0
|
||||
@@ -14750,7 +14741,7 @@ snapshots:
|
||||
'@jest/transform': 29.7.0
|
||||
'@jest/types': 29.6.3
|
||||
'@jridgewell/trace-mapping': 0.3.25
|
||||
'@types/node': 20.11.29
|
||||
'@types/node': 20.14.8
|
||||
chalk: 4.1.2
|
||||
collect-v8-coverage: 1.0.2
|
||||
exit: 0.1.2
|
||||
@@ -15046,8 +15037,8 @@ snapshots:
|
||||
'@mui/base@5.0.0-beta.40(@types/react@18.2.79)(react-dom@18.2.0(react@18.2.0))(react@18.2.0)':
|
||||
dependencies:
|
||||
'@babel/runtime': 7.28.2
|
||||
'@floating-ui/react-dom': 2.1.4(react-dom@18.2.0(react@18.2.0))(react@18.2.0)
|
||||
'@mui/types': 7.4.4(@types/react@18.2.79)
|
||||
'@floating-ui/react-dom': 2.1.5(react-dom@18.2.0(react@18.2.0))(react@18.2.0)
|
||||
'@mui/types': 7.4.5(@types/react@18.2.79)
|
||||
'@mui/utils': 5.17.1(@types/react@18.2.79)(react@18.2.0)
|
||||
'@popperjs/core': 2.11.8
|
||||
clsx: 2.1.1
|
||||
@@ -15065,7 +15056,7 @@ snapshots:
|
||||
'@mui/base': 5.0.0-beta.40(@types/react@18.2.79)(react-dom@18.2.0(react@18.2.0))(react@18.2.0)
|
||||
'@mui/core-downloads-tracker': 5.18.0
|
||||
'@mui/system': 5.16.7(@emotion/react@11.11.4(@types/react@18.2.79)(react@18.2.0))(@emotion/styled@11.11.5(@emotion/react@11.11.4(@types/react@18.2.79)(react@18.2.0))(@types/react@18.2.79)(react@18.2.0))(@types/react@18.2.79)(react@18.2.0)
|
||||
'@mui/types': 7.4.4(@types/react@18.2.79)
|
||||
'@mui/types': 7.4.5(@types/react@18.2.79)
|
||||
'@mui/utils': 5.17.1(@types/react@18.2.79)(react@18.2.0)
|
||||
'@types/react-transition-group': 4.4.12(@types/react@18.2.79)
|
||||
clsx: 2.1.1
|
||||
@@ -15106,7 +15097,7 @@ snapshots:
|
||||
'@babel/runtime': 7.28.2
|
||||
'@mui/private-theming': 5.17.1(@types/react@18.2.79)(react@18.2.0)
|
||||
'@mui/styled-engine': 5.18.0(@emotion/react@11.11.4(@types/react@18.2.79)(react@18.2.0))(@emotion/styled@11.11.5(@emotion/react@11.11.4(@types/react@18.2.79)(react@18.2.0))(@types/react@18.2.79)(react@18.2.0))(react@18.2.0)
|
||||
'@mui/types': 7.4.4(@types/react@18.2.79)
|
||||
'@mui/types': 7.4.5(@types/react@18.2.79)
|
||||
'@mui/utils': 5.17.1(@types/react@18.2.79)(react@18.2.0)
|
||||
clsx: 2.1.1
|
||||
csstype: 3.1.3
|
||||
@@ -15125,7 +15116,7 @@ snapshots:
|
||||
optionalDependencies:
|
||||
'@types/react': 18.2.79
|
||||
|
||||
'@mui/types@7.4.4(@types/react@18.2.79)':
|
||||
'@mui/types@7.4.5(@types/react@18.2.79)':
|
||||
dependencies:
|
||||
'@babel/runtime': 7.28.2
|
||||
optionalDependencies:
|
||||
@@ -17155,19 +17146,15 @@ snapshots:
|
||||
dependencies:
|
||||
'@sinonjs/commons': 3.0.1
|
||||
|
||||
'@slack/logger@3.0.0':
|
||||
dependencies:
|
||||
'@types/node': 20.11.29
|
||||
|
||||
'@slack/logger@4.0.0':
|
||||
dependencies:
|
||||
'@types/node': 20.11.29
|
||||
|
||||
'@slack/oauth@2.6.3':
|
||||
'@slack/oauth@3.0.3':
|
||||
dependencies:
|
||||
'@slack/logger': 3.0.0
|
||||
'@slack/web-api': 6.13.0
|
||||
'@types/jsonwebtoken': 8.5.9
|
||||
'@slack/logger': 4.0.0
|
||||
'@slack/web-api': 7.9.3
|
||||
'@types/jsonwebtoken': 9.0.10
|
||||
'@types/node': 20.11.29
|
||||
jsonwebtoken: 9.0.2
|
||||
lodash.isstring: 4.0.1
|
||||
@@ -17176,22 +17163,6 @@ snapshots:
|
||||
|
||||
'@slack/types@2.15.0': {}
|
||||
|
||||
'@slack/web-api@6.13.0':
|
||||
dependencies:
|
||||
'@slack/logger': 3.0.0
|
||||
'@slack/types': 2.15.0
|
||||
'@types/is-stream': 1.1.0
|
||||
'@types/node': 20.11.29
|
||||
axios: 1.8.2
|
||||
eventemitter3: 3.1.2
|
||||
form-data: 2.5.3
|
||||
is-electron: 2.2.2
|
||||
is-stream: 1.1.0
|
||||
p-queue: 6.6.2
|
||||
p-retry: 4.6.2
|
||||
transitivePeerDependencies:
|
||||
- debug
|
||||
|
||||
'@slack/web-api@7.9.3':
|
||||
dependencies:
|
||||
'@slack/logger': 4.0.0
|
||||
@@ -18075,7 +18046,7 @@ snapshots:
|
||||
|
||||
'@types/debug@4.1.8':
|
||||
dependencies:
|
||||
'@types/ms': 0.7.34
|
||||
'@types/ms': 2.1.0
|
||||
|
||||
'@types/deep-eql@4.0.2': {}
|
||||
|
||||
@@ -18114,7 +18085,7 @@ snapshots:
|
||||
|
||||
'@types/express-serve-static-core@4.19.6':
|
||||
dependencies:
|
||||
'@types/node': 20.11.29
|
||||
'@types/node': 20.14.8
|
||||
'@types/qs': 6.14.0
|
||||
'@types/range-parser': 1.2.7
|
||||
'@types/send': 0.17.5
|
||||
@@ -18141,7 +18112,7 @@ snapshots:
|
||||
|
||||
'@types/graceful-fs@4.1.9':
|
||||
dependencies:
|
||||
'@types/node': 20.11.29
|
||||
'@types/node': 20.14.8
|
||||
|
||||
'@types/hammerjs@2.0.46': {}
|
||||
|
||||
@@ -18151,10 +18122,6 @@ snapshots:
|
||||
|
||||
'@types/http-errors@2.0.5': {}
|
||||
|
||||
'@types/is-stream@1.1.0':
|
||||
dependencies:
|
||||
'@types/node': 20.11.29
|
||||
|
||||
'@types/istanbul-lib-coverage@2.0.6': {}
|
||||
|
||||
'@types/istanbul-lib-report@3.0.3':
|
||||
@@ -18180,8 +18147,9 @@ snapshots:
|
||||
|
||||
'@types/json5@0.0.29': {}
|
||||
|
||||
'@types/jsonwebtoken@8.5.9':
|
||||
'@types/jsonwebtoken@9.0.10':
|
||||
dependencies:
|
||||
'@types/ms': 2.1.0
|
||||
'@types/node': 20.11.29
|
||||
|
||||
'@types/katex@0.16.7': {}
|
||||
@@ -18194,16 +18162,16 @@ snapshots:
|
||||
|
||||
'@types/mime@1.3.5': {}
|
||||
|
||||
'@types/ms@0.7.34': {}
|
||||
'@types/ms@2.1.0': {}
|
||||
|
||||
'@types/mysql@2.15.26':
|
||||
dependencies:
|
||||
'@types/node': 20.11.29
|
||||
|
||||
'@types/node-fetch@2.6.12':
|
||||
'@types/node-fetch@2.6.13':
|
||||
dependencies:
|
||||
'@types/node': 20.11.29
|
||||
form-data: 4.0.2
|
||||
form-data: 4.0.4
|
||||
|
||||
'@types/node@18.19.120':
|
||||
dependencies:
|
||||
@@ -19285,8 +19253,8 @@ snapshots:
|
||||
|
||||
browserslist@4.25.1:
|
||||
dependencies:
|
||||
caniuse-lite: 1.0.30001727
|
||||
electron-to-chromium: 1.5.192
|
||||
caniuse-lite: 1.0.30001733
|
||||
electron-to-chromium: 1.5.199
|
||||
node-releases: 2.0.19
|
||||
update-browserslist-db: 1.1.3(browserslist@4.25.1)
|
||||
|
||||
@@ -19343,7 +19311,7 @@ snapshots:
|
||||
chokidar: 4.0.3
|
||||
confbox: 0.2.2
|
||||
defu: 6.1.4
|
||||
dotenv: 16.5.0
|
||||
dotenv: 16.6.1
|
||||
exsolve: 1.0.5
|
||||
giget: 2.0.0
|
||||
jiti: 2.4.2
|
||||
@@ -19385,7 +19353,7 @@ snapshots:
|
||||
|
||||
caniuse-lite@1.0.30001723: {}
|
||||
|
||||
caniuse-lite@1.0.30001727: {}
|
||||
caniuse-lite@1.0.30001733: {}
|
||||
|
||||
ccount@2.0.1: {}
|
||||
|
||||
@@ -20292,14 +20260,12 @@ snapshots:
|
||||
|
||||
dotenv-expand@11.0.6:
|
||||
dependencies:
|
||||
dotenv: 16.4.5
|
||||
dotenv: 16.6.1
|
||||
|
||||
dotenv@16.0.3: {}
|
||||
|
||||
dotenv@16.4.5: {}
|
||||
|
||||
dotenv@16.5.0: {}
|
||||
|
||||
dotenv@16.6.1: {}
|
||||
|
||||
dunder-proto@1.0.1:
|
||||
@@ -20329,7 +20295,7 @@ snapshots:
|
||||
|
||||
electron-to-chromium@1.5.167: {}
|
||||
|
||||
electron-to-chromium@1.5.192: {}
|
||||
electron-to-chromium@1.5.199: {}
|
||||
|
||||
electron-to-chromium@1.5.33: {}
|
||||
|
||||
@@ -20359,7 +20325,7 @@ snapshots:
|
||||
graceful-fs: 4.2.11
|
||||
tapable: 2.2.1
|
||||
|
||||
enhanced-resolve@5.18.2:
|
||||
enhanced-resolve@5.18.3:
|
||||
dependencies:
|
||||
graceful-fs: 4.2.11
|
||||
tapable: 2.2.2
|
||||
@@ -20585,11 +20551,11 @@ snapshots:
|
||||
eslint-plugin-n: 16.6.2(eslint@8.57.0)
|
||||
eslint-plugin-promise: 6.4.0(eslint@8.57.0)
|
||||
|
||||
eslint-config-turbo@2.5.5(eslint@8.57.0)(turbo@2.5.5):
|
||||
eslint-config-turbo@2.5.6(eslint@8.57.0)(turbo@2.5.6):
|
||||
dependencies:
|
||||
eslint: 8.57.0
|
||||
eslint-plugin-turbo: 2.5.5(eslint@8.57.0)(turbo@2.5.5)
|
||||
turbo: 2.5.5
|
||||
eslint-plugin-turbo: 2.5.6(eslint@8.57.0)(turbo@2.5.6)
|
||||
turbo: 2.5.6
|
||||
|
||||
eslint-import-resolver-alias@1.1.2(eslint-plugin-import@2.29.1(@typescript-eslint/parser@7.12.0(eslint@8.57.0)(typescript@5.4.5))(eslint-import-resolver-typescript@3.6.1)(eslint@8.57.0)):
|
||||
dependencies:
|
||||
@@ -20834,11 +20800,11 @@ snapshots:
|
||||
'@microsoft/tsdoc': 0.14.2
|
||||
'@microsoft/tsdoc-config': 0.16.2
|
||||
|
||||
eslint-plugin-turbo@2.5.5(eslint@8.57.0)(turbo@2.5.5):
|
||||
eslint-plugin-turbo@2.5.6(eslint@8.57.0)(turbo@2.5.6):
|
||||
dependencies:
|
||||
dotenv: 16.0.3
|
||||
eslint: 8.57.0
|
||||
turbo: 2.5.5
|
||||
turbo: 2.5.6
|
||||
|
||||
eslint-plugin-unicorn@51.0.1(eslint@8.57.0):
|
||||
dependencies:
|
||||
@@ -20976,8 +20942,6 @@ snapshots:
|
||||
|
||||
event-target-shim@5.0.1: {}
|
||||
|
||||
eventemitter3@3.1.2: {}
|
||||
|
||||
eventemitter3@4.0.7: {}
|
||||
|
||||
eventemitter3@5.0.1: {}
|
||||
@@ -21942,8 +21906,6 @@ snapshots:
|
||||
dependencies:
|
||||
protocols: 2.0.2
|
||||
|
||||
is-stream@1.1.0: {}
|
||||
|
||||
is-stream@2.0.1: {}
|
||||
|
||||
is-stream@3.0.0: {}
|
||||
@@ -22076,7 +22038,7 @@ snapshots:
|
||||
'@jest/expect': 29.7.0
|
||||
'@jest/test-result': 29.7.0
|
||||
'@jest/types': 29.6.3
|
||||
'@types/node': 20.11.29
|
||||
'@types/node': 20.14.8
|
||||
chalk: 4.1.2
|
||||
co: 4.6.0
|
||||
dedent: 1.5.1(babel-plugin-macros@3.1.0)
|
||||
@@ -22236,7 +22198,7 @@ snapshots:
|
||||
'@jest/environment': 29.7.0
|
||||
'@jest/fake-timers': 29.7.0
|
||||
'@jest/types': 29.6.3
|
||||
'@types/node': 20.11.29
|
||||
'@types/node': 20.14.8
|
||||
jest-mock: 29.7.0
|
||||
jest-util: 29.7.0
|
||||
|
||||
@@ -22246,7 +22208,7 @@ snapshots:
|
||||
dependencies:
|
||||
'@jest/types': 29.6.3
|
||||
'@types/graceful-fs': 4.1.9
|
||||
'@types/node': 20.11.29
|
||||
'@types/node': 20.14.8
|
||||
anymatch: 3.1.3
|
||||
fb-watchman: 2.0.2
|
||||
graceful-fs: 4.2.11
|
||||
@@ -22320,7 +22282,7 @@ snapshots:
|
||||
'@jest/test-result': 29.7.0
|
||||
'@jest/transform': 29.7.0
|
||||
'@jest/types': 29.6.3
|
||||
'@types/node': 20.11.29
|
||||
'@types/node': 20.14.8
|
||||
chalk: 4.1.2
|
||||
emittery: 0.13.1
|
||||
graceful-fs: 4.2.11
|
||||
@@ -22348,7 +22310,7 @@ snapshots:
|
||||
'@jest/test-result': 29.7.0
|
||||
'@jest/transform': 29.7.0
|
||||
'@jest/types': 29.6.3
|
||||
'@types/node': 20.11.29
|
||||
'@types/node': 20.14.8
|
||||
chalk: 4.1.2
|
||||
cjs-module-lexer: 1.4.1
|
||||
collect-v8-coverage: 1.0.2
|
||||
@@ -22413,7 +22375,7 @@ snapshots:
|
||||
dependencies:
|
||||
'@jest/test-result': 29.7.0
|
||||
'@jest/types': 29.6.3
|
||||
'@types/node': 20.11.29
|
||||
'@types/node': 20.14.8
|
||||
ansi-escapes: 4.3.2
|
||||
chalk: 4.1.2
|
||||
emittery: 0.13.1
|
||||
@@ -22428,7 +22390,7 @@ snapshots:
|
||||
|
||||
jest-worker@29.7.0:
|
||||
dependencies:
|
||||
'@types/node': 20.11.29
|
||||
'@types/node': 20.14.8
|
||||
jest-util: 29.7.0
|
||||
merge-stream: 2.0.0
|
||||
supports-color: 8.1.1
|
||||
@@ -22674,40 +22636,13 @@ snapshots:
|
||||
- openai
|
||||
- ws
|
||||
|
||||
langchain@0.3.28(@langchain/anthropic@0.3.22(@langchain/core@0.3.58(openai@4.104.0(zod@3.25.62))))(@langchain/aws@0.1.11(@langchain/core@0.3.58(openai@4.104.0(zod@3.25.62))))(@langchain/core@0.3.58(openai@4.104.0(zod@3.25.62)))(@langchain/google-genai@0.2.12(@langchain/core@0.3.58(openai@4.104.0(zod@3.25.62))))(@langchain/google-vertexai@0.2.12(@langchain/core@0.3.58(openai@4.104.0(zod@3.25.62)))(zod@3.25.62))(axios@1.8.2)(cheerio@1.0.0)(handlebars@4.7.8)(openai@4.104.0(zod@3.25.62)):
|
||||
dependencies:
|
||||
'@langchain/core': 0.3.58(openai@4.104.0(zod@3.25.62))
|
||||
'@langchain/openai': 0.5.13(@langchain/core@0.3.58(openai@4.104.0(zod@3.25.62)))
|
||||
'@langchain/textsplitters': 0.1.0(@langchain/core@0.3.58(openai@4.104.0(zod@3.25.62)))
|
||||
js-tiktoken: 1.0.15
|
||||
js-yaml: 4.1.0
|
||||
jsonpointer: 5.0.1
|
||||
langsmith: 0.3.30(openai@4.104.0(zod@3.25.62))
|
||||
openapi-types: 12.1.3
|
||||
p-retry: 4.6.2
|
||||
uuid: 10.0.0
|
||||
yaml: 2.5.1
|
||||
zod: 3.25.62
|
||||
optionalDependencies:
|
||||
'@langchain/anthropic': 0.3.22(@langchain/core@0.3.58(openai@4.104.0(zod@3.25.62)))
|
||||
'@langchain/aws': 0.1.11(@langchain/core@0.3.58(openai@4.104.0(zod@3.25.62)))
|
||||
'@langchain/google-genai': 0.2.12(@langchain/core@0.3.58(openai@4.104.0(zod@3.25.62)))
|
||||
'@langchain/google-vertexai': 0.2.12(@langchain/core@0.3.58(openai@4.104.0(zod@3.25.62)))(zod@3.25.62)
|
||||
axios: 1.8.2
|
||||
cheerio: 1.0.0
|
||||
handlebars: 4.7.8
|
||||
transitivePeerDependencies:
|
||||
- encoding
|
||||
- openai
|
||||
- ws
|
||||
|
||||
langfuse-core@3.38.4:
|
||||
dependencies:
|
||||
mustache: 4.2.0
|
||||
|
||||
langfuse-langchain@3.38.4(langchain@0.3.28(@langchain/anthropic@0.3.22(@langchain/core@0.3.58(openai@4.104.0(zod@3.25.62))))(@langchain/aws@0.1.11(@langchain/core@0.3.58(openai@4.104.0(zod@3.25.62))))(@langchain/core@0.3.58(openai@4.104.0(zod@3.25.62)))(@langchain/google-genai@0.2.12(@langchain/core@0.3.58(openai@4.104.0(zod@3.25.62))))(@langchain/google-vertexai@0.2.12(@langchain/core@0.3.58(openai@4.104.0(zod@3.25.62)))(zod@3.25.62))(axios@1.8.2)(cheerio@1.0.0)(handlebars@4.7.8)(openai@4.104.0(zod@3.25.62))):
|
||||
langfuse-langchain@3.38.4(langchain@0.3.28(@langchain/anthropic@0.3.22(@langchain/core@0.3.58(openai@4.104.0(zod@3.25.62))))(@langchain/aws@0.1.11(@langchain/core@0.3.58(openai@4.104.0(zod@3.25.62))))(@langchain/core@0.3.58(openai@4.104.0(zod@3.25.62)))(@langchain/google-genai@0.2.12(@langchain/core@0.3.58(openai@4.104.0(zod@3.25.62))))(@langchain/google-vertexai@0.2.12(@langchain/core@0.3.58(openai@4.104.0(zod@3.25.62)))(zod@3.25.62))(axios@1.11.0)(cheerio@1.0.0)(handlebars@4.7.8)(openai@4.104.0(zod@3.25.62))):
|
||||
dependencies:
|
||||
langchain: 0.3.28(@langchain/anthropic@0.3.22(@langchain/core@0.3.58(openai@4.104.0(zod@3.25.62))))(@langchain/aws@0.1.11(@langchain/core@0.3.58(openai@4.104.0(zod@3.25.62))))(@langchain/core@0.3.58(openai@4.104.0(zod@3.25.62)))(@langchain/google-genai@0.2.12(@langchain/core@0.3.58(openai@4.104.0(zod@3.25.62))))(@langchain/google-vertexai@0.2.12(@langchain/core@0.3.58(openai@4.104.0(zod@3.25.62)))(zod@3.25.62))(axios@1.8.2)(cheerio@1.0.0)(handlebars@4.7.8)(openai@4.104.0(zod@3.25.62))
|
||||
langchain: 0.3.28(@langchain/anthropic@0.3.22(@langchain/core@0.3.58(openai@4.104.0(zod@3.25.62))))(@langchain/aws@0.1.11(@langchain/core@0.3.58(openai@4.104.0(zod@3.25.62))))(@langchain/core@0.3.58(openai@4.104.0(zod@3.25.62)))(@langchain/google-genai@0.2.12(@langchain/core@0.3.58(openai@4.104.0(zod@3.25.62))))(@langchain/google-vertexai@0.2.12(@langchain/core@0.3.58(openai@4.104.0(zod@3.25.62)))(zod@3.25.62))(axios@1.11.0)(cheerio@1.0.0)(handlebars@4.7.8)(openai@4.104.0(zod@3.25.62))
|
||||
langfuse: 3.38.4
|
||||
langfuse-core: 3.38.4
|
||||
|
||||
@@ -23740,7 +23675,7 @@ snapshots:
|
||||
openai@4.104.0(zod@3.25.32):
|
||||
dependencies:
|
||||
'@types/node': 18.19.120
|
||||
'@types/node-fetch': 2.6.12
|
||||
'@types/node-fetch': 2.6.13
|
||||
abort-controller: 3.0.0
|
||||
agentkeepalive: 4.6.0
|
||||
form-data-encoder: 1.7.2
|
||||
@@ -23754,7 +23689,7 @@ snapshots:
|
||||
openai@4.104.0(zod@3.25.62):
|
||||
dependencies:
|
||||
'@types/node': 18.19.120
|
||||
'@types/node-fetch': 2.6.12
|
||||
'@types/node-fetch': 2.6.13
|
||||
abort-controller: 3.0.0
|
||||
agentkeepalive: 4.6.0
|
||||
form-data-encoder: 1.7.2
|
||||
@@ -25650,32 +25585,32 @@ snapshots:
|
||||
dependencies:
|
||||
fast-fifo: 1.3.2
|
||||
|
||||
turbo-darwin-64@2.5.5:
|
||||
turbo-darwin-64@2.5.6:
|
||||
optional: true
|
||||
|
||||
turbo-darwin-arm64@2.5.5:
|
||||
turbo-darwin-arm64@2.5.6:
|
||||
optional: true
|
||||
|
||||
turbo-linux-64@2.5.5:
|
||||
turbo-linux-64@2.5.6:
|
||||
optional: true
|
||||
|
||||
turbo-linux-arm64@2.5.5:
|
||||
turbo-linux-arm64@2.5.6:
|
||||
optional: true
|
||||
|
||||
turbo-windows-64@2.5.5:
|
||||
turbo-windows-64@2.5.6:
|
||||
optional: true
|
||||
|
||||
turbo-windows-arm64@2.5.5:
|
||||
turbo-windows-arm64@2.5.6:
|
||||
optional: true
|
||||
|
||||
turbo@2.5.5:
|
||||
turbo@2.5.6:
|
||||
optionalDependencies:
|
||||
turbo-darwin-64: 2.5.5
|
||||
turbo-darwin-arm64: 2.5.5
|
||||
turbo-linux-64: 2.5.5
|
||||
turbo-linux-arm64: 2.5.5
|
||||
turbo-windows-64: 2.5.5
|
||||
turbo-windows-arm64: 2.5.5
|
||||
turbo-darwin-64: 2.5.6
|
||||
turbo-darwin-arm64: 2.5.6
|
||||
turbo-linux-64: 2.5.6
|
||||
turbo-linux-arm64: 2.5.6
|
||||
turbo-windows-64: 2.5.6
|
||||
turbo-windows-arm64: 2.5.6
|
||||
|
||||
type-check@0.4.0:
|
||||
dependencies:
|
||||
@@ -26218,7 +26153,7 @@ snapshots:
|
||||
acorn: 8.15.0
|
||||
browserslist: 4.25.1
|
||||
chrome-trace-event: 1.0.4
|
||||
enhanced-resolve: 5.18.2
|
||||
enhanced-resolve: 5.18.3
|
||||
es-module-lexer: 1.7.0
|
||||
eslint-scope: 5.1.1
|
||||
events: 3.3.0
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ FROM --platform=${TARGETPLATFORM:-linux/amd64} node:20-alpine AS alpine
|
||||
RUN apk update && apk upgrade --no-cache libcrypto3 libssl3 libc6-compat busybox ssl_client
|
||||
|
||||
FROM --platform=${TARGETPLATFORM:-linux/amd64} alpine AS base
|
||||
RUN npm install turbo@^2.5.5 --global
|
||||
RUN npm install turbo@^2.5.6 --global
|
||||
ENV PNPM_HOME="/pnpm"
|
||||
ENV PATH="$PNPM_HOME:$PATH"
|
||||
RUN corepack enable
|
||||
|
||||
+2
-4
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "web",
|
||||
"version": "3.94.0",
|
||||
"version": "3.99.0",
|
||||
"private": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
@@ -9,7 +9,7 @@
|
||||
"scripts": {
|
||||
"build": "INLINE_RUNTIME_CHUNK=false dotenv -e ../.env -- next build",
|
||||
"dev": "dotenv -e ../.env -- next dev",
|
||||
"dev:https": "dotenv -e ../.env -- next dev --experimental-https --experimental-https-key ./localhost+1-key.pem --experimental-https-cert ./localhost+1.pem",
|
||||
"dev:http": "dotenv -e ../.env -- next dev --experimental-https --experimental-https-key ./localhost+1-key.pem --experimental-https-cert ./localhost+1.pem",
|
||||
"lint": "dotenv -e ../.env -- next lint --max-warnings 0",
|
||||
"lint:fix": "dotenv -e ../.env -- next lint --fix",
|
||||
"clean": "rm -rf node_modules",
|
||||
@@ -84,8 +84,6 @@
|
||||
"@radix-ui/react-tooltip": "^1.2.7",
|
||||
"@remixicon/react": "^4.2.0",
|
||||
"@sentry/nextjs": "^8.52.0",
|
||||
"@slack/oauth": "^2.6.0",
|
||||
"@slack/web-api": "^7.0.0",
|
||||
"@t3-oss/env-nextjs": "^0.11.1",
|
||||
"@tailwindcss/container-queries": "^0.1.1",
|
||||
"@tanstack/react-query": "^4.36.1",
|
||||
|
||||
@@ -79,6 +79,52 @@ paths:
|
||||
schema: {}
|
||||
security:
|
||||
- BasicAuth: []
|
||||
post:
|
||||
description: Create an annotation queue
|
||||
operationId: annotationQueues_createQueue
|
||||
tags:
|
||||
- AnnotationQueues
|
||||
parameters: []
|
||||
responses:
|
||||
'200':
|
||||
description: ''
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/AnnotationQueue'
|
||||
'400':
|
||||
description: ''
|
||||
content:
|
||||
application/json:
|
||||
schema: {}
|
||||
'401':
|
||||
description: ''
|
||||
content:
|
||||
application/json:
|
||||
schema: {}
|
||||
'403':
|
||||
description: ''
|
||||
content:
|
||||
application/json:
|
||||
schema: {}
|
||||
'404':
|
||||
description: ''
|
||||
content:
|
||||
application/json:
|
||||
schema: {}
|
||||
'405':
|
||||
description: ''
|
||||
content:
|
||||
application/json:
|
||||
schema: {}
|
||||
security:
|
||||
- BasicAuth: []
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/CreateAnnotationQueueRequest'
|
||||
/api/public/annotation-queues/{queueId}:
|
||||
get:
|
||||
description: Get an annotation queue by ID
|
||||
@@ -409,6 +455,111 @@ paths:
|
||||
schema: {}
|
||||
security:
|
||||
- BasicAuth: []
|
||||
/api/public/annotation-queues/{queueId}/assignments:
|
||||
post:
|
||||
description: Create an assignment for a user to an annotation queue
|
||||
operationId: annotationQueues_createQueueAssignment
|
||||
tags:
|
||||
- AnnotationQueues
|
||||
parameters:
|
||||
- name: queueId
|
||||
in: path
|
||||
description: The unique identifier of the annotation queue
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
responses:
|
||||
'200':
|
||||
description: ''
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/CreateAnnotationQueueAssignmentResponse'
|
||||
'400':
|
||||
description: ''
|
||||
content:
|
||||
application/json:
|
||||
schema: {}
|
||||
'401':
|
||||
description: ''
|
||||
content:
|
||||
application/json:
|
||||
schema: {}
|
||||
'403':
|
||||
description: ''
|
||||
content:
|
||||
application/json:
|
||||
schema: {}
|
||||
'404':
|
||||
description: ''
|
||||
content:
|
||||
application/json:
|
||||
schema: {}
|
||||
'405':
|
||||
description: ''
|
||||
content:
|
||||
application/json:
|
||||
schema: {}
|
||||
security:
|
||||
- BasicAuth: []
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/AnnotationQueueAssignmentRequest'
|
||||
delete:
|
||||
description: Delete an assignment for a user to an annotation queue
|
||||
operationId: annotationQueues_deleteQueueAssignment
|
||||
tags:
|
||||
- AnnotationQueues
|
||||
parameters:
|
||||
- name: queueId
|
||||
in: path
|
||||
description: The unique identifier of the annotation queue
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
responses:
|
||||
'200':
|
||||
description: ''
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/DeleteAnnotationQueueAssignmentResponse'
|
||||
'400':
|
||||
description: ''
|
||||
content:
|
||||
application/json:
|
||||
schema: {}
|
||||
'401':
|
||||
description: ''
|
||||
content:
|
||||
application/json:
|
||||
schema: {}
|
||||
'403':
|
||||
description: ''
|
||||
content:
|
||||
application/json:
|
||||
schema: {}
|
||||
'404':
|
||||
description: ''
|
||||
content:
|
||||
application/json:
|
||||
schema: {}
|
||||
'405':
|
||||
description: ''
|
||||
content:
|
||||
application/json:
|
||||
schema: {}
|
||||
security:
|
||||
- BasicAuth: []
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/AnnotationQueueAssignmentRequest'
|
||||
/api/public/comments:
|
||||
post:
|
||||
description: >-
|
||||
@@ -2223,6 +2374,54 @@ paths:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/MembershipRequest'
|
||||
delete:
|
||||
description: >-
|
||||
Delete a membership from the organization associated with the API key
|
||||
(requires organization-scoped API key)
|
||||
operationId: organizations_deleteOrganizationMembership
|
||||
tags:
|
||||
- Organizations
|
||||
parameters: []
|
||||
responses:
|
||||
'200':
|
||||
description: ''
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/MembershipDeletionResponse'
|
||||
'400':
|
||||
description: ''
|
||||
content:
|
||||
application/json:
|
||||
schema: {}
|
||||
'401':
|
||||
description: ''
|
||||
content:
|
||||
application/json:
|
||||
schema: {}
|
||||
'403':
|
||||
description: ''
|
||||
content:
|
||||
application/json:
|
||||
schema: {}
|
||||
'404':
|
||||
description: ''
|
||||
content:
|
||||
application/json:
|
||||
schema: {}
|
||||
'405':
|
||||
description: ''
|
||||
content:
|
||||
application/json:
|
||||
schema: {}
|
||||
security:
|
||||
- BasicAuth: []
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/DeleteMembershipRequest'
|
||||
/api/public/projects/{projectId}/memberships:
|
||||
get:
|
||||
description: >-
|
||||
@@ -2325,6 +2524,60 @@ paths:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/MembershipRequest'
|
||||
delete:
|
||||
description: >-
|
||||
Delete a membership from a specific project (requires
|
||||
organization-scoped API key). The user must be a member of the
|
||||
organization.
|
||||
operationId: organizations_deleteProjectMembership
|
||||
tags:
|
||||
- Organizations
|
||||
parameters:
|
||||
- name: projectId
|
||||
in: path
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
responses:
|
||||
'200':
|
||||
description: ''
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/MembershipDeletionResponse'
|
||||
'400':
|
||||
description: ''
|
||||
content:
|
||||
application/json:
|
||||
schema: {}
|
||||
'401':
|
||||
description: ''
|
||||
content:
|
||||
application/json:
|
||||
schema: {}
|
||||
'403':
|
||||
description: ''
|
||||
content:
|
||||
application/json:
|
||||
schema: {}
|
||||
'404':
|
||||
description: ''
|
||||
content:
|
||||
application/json:
|
||||
schema: {}
|
||||
'405':
|
||||
description: ''
|
||||
content:
|
||||
application/json:
|
||||
schema: {}
|
||||
security:
|
||||
- BasicAuth: []
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/DeleteMembershipRequest'
|
||||
/api/public/organizations/projects:
|
||||
get:
|
||||
description: >-
|
||||
@@ -4354,6 +4607,22 @@ components:
|
||||
required:
|
||||
- data
|
||||
- meta
|
||||
CreateAnnotationQueueRequest:
|
||||
title: CreateAnnotationQueueRequest
|
||||
type: object
|
||||
properties:
|
||||
name:
|
||||
type: string
|
||||
description:
|
||||
type: string
|
||||
nullable: true
|
||||
scoreConfigIds:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
required:
|
||||
- name
|
||||
- scoreConfigIds
|
||||
CreateAnnotationQueueItemRequest:
|
||||
title: CreateAnnotationQueueItemRequest
|
||||
type: object
|
||||
@@ -4387,6 +4656,36 @@ components:
|
||||
required:
|
||||
- success
|
||||
- message
|
||||
AnnotationQueueAssignmentRequest:
|
||||
title: AnnotationQueueAssignmentRequest
|
||||
type: object
|
||||
properties:
|
||||
userId:
|
||||
type: string
|
||||
required:
|
||||
- userId
|
||||
DeleteAnnotationQueueAssignmentResponse:
|
||||
title: DeleteAnnotationQueueAssignmentResponse
|
||||
type: object
|
||||
properties:
|
||||
success:
|
||||
type: boolean
|
||||
required:
|
||||
- success
|
||||
CreateAnnotationQueueAssignmentResponse:
|
||||
title: CreateAnnotationQueueAssignmentResponse
|
||||
type: object
|
||||
properties:
|
||||
userId:
|
||||
type: string
|
||||
queueId:
|
||||
type: string
|
||||
projectId:
|
||||
type: string
|
||||
required:
|
||||
- userId
|
||||
- queueId
|
||||
- projectId
|
||||
CreateCommentRequest:
|
||||
title: CreateCommentRequest
|
||||
type: object
|
||||
@@ -5773,6 +6072,13 @@ components:
|
||||
- SPAN
|
||||
- GENERATION
|
||||
- EVENT
|
||||
- AGENT
|
||||
- TOOL
|
||||
- CHAIN
|
||||
- RETRIEVER
|
||||
- EVALUATOR
|
||||
- EMBEDDING
|
||||
- GUARDRAIL
|
||||
IngestionUsage:
|
||||
title: IngestionUsage
|
||||
oneOf:
|
||||
@@ -6710,6 +7016,14 @@ components:
|
||||
required:
|
||||
- userId
|
||||
- role
|
||||
DeleteMembershipRequest:
|
||||
title: DeleteMembershipRequest
|
||||
type: object
|
||||
properties:
|
||||
userId:
|
||||
type: string
|
||||
required:
|
||||
- userId
|
||||
MembershipResponse:
|
||||
title: MembershipResponse
|
||||
type: object
|
||||
@@ -6727,6 +7041,17 @@ components:
|
||||
- role
|
||||
- email
|
||||
- name
|
||||
MembershipDeletionResponse:
|
||||
title: MembershipDeletionResponse
|
||||
type: object
|
||||
properties:
|
||||
message:
|
||||
type: string
|
||||
userId:
|
||||
type: string
|
||||
required:
|
||||
- message
|
||||
- userId
|
||||
MembershipsResponse:
|
||||
title: MembershipsResponse
|
||||
type: object
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -14,6 +14,7 @@ import {
|
||||
CreateAnnotationQueueItemResponse,
|
||||
UpdateAnnotationQueueItemResponse,
|
||||
DeleteAnnotationQueueItemResponse,
|
||||
CreateAnnotationQueueResponse,
|
||||
} from "@/src/features/public-api/types/annotation-queues";
|
||||
import {
|
||||
AnnotationQueueObjectType,
|
||||
@@ -173,6 +174,120 @@ describe("Annotation Queues API Endpoints", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("POST /annotation-queues", () => {
|
||||
it("should create a new annotation queue", async () => {
|
||||
const scoreConfig = await prisma.scoreConfig.create({
|
||||
data: {
|
||||
name: "Test Score Config",
|
||||
description: "Test Score Config Description",
|
||||
projectId,
|
||||
dataType: "NUMERIC",
|
||||
},
|
||||
});
|
||||
|
||||
const response = await makeZodVerifiedAPICall(
|
||||
CreateAnnotationQueueResponse,
|
||||
"POST",
|
||||
"/api/public/annotation-queues",
|
||||
{
|
||||
name: "Test Queue",
|
||||
description: "Test Queue Description",
|
||||
scoreConfigIds: [scoreConfig.id],
|
||||
},
|
||||
auth,
|
||||
);
|
||||
|
||||
expect(response.status).toBe(200);
|
||||
expect(response.body.id).toBeDefined();
|
||||
expect(response.body.name).toBe("Test Queue");
|
||||
expect(response.body.description).toBe("Test Queue Description");
|
||||
expect(response.body.scoreConfigIds).toEqual([scoreConfig.id]);
|
||||
});
|
||||
|
||||
it("should return 400 if the queue name already exists", async () => {
|
||||
const response = await makeAPICall(
|
||||
"POST",
|
||||
"/api/public/annotation-queues",
|
||||
{
|
||||
name: "Test Queue",
|
||||
description: "Test Queue Description",
|
||||
scoreConfigIds: [],
|
||||
},
|
||||
auth,
|
||||
);
|
||||
|
||||
expect(response.status).toBe(400);
|
||||
});
|
||||
|
||||
it("should return 400 if no score config IDs are provided", async () => {
|
||||
const response = await makeAPICall(
|
||||
"POST",
|
||||
"/api/public/annotation-queues",
|
||||
{
|
||||
name: "No configs queue",
|
||||
description: "Test Queue Description",
|
||||
scoreConfigIds: [],
|
||||
},
|
||||
auth,
|
||||
);
|
||||
|
||||
expect(response.status).toBe(400);
|
||||
});
|
||||
|
||||
it("should return 400 if the score config IDs are invalid", async () => {
|
||||
const response = await makeAPICall(
|
||||
"POST",
|
||||
"/api/public/annotation-queues",
|
||||
{
|
||||
name: "Invalid configs queue",
|
||||
description: "Test Queue Description",
|
||||
scoreConfigIds: ["invalid-score-config-id"],
|
||||
},
|
||||
auth,
|
||||
);
|
||||
|
||||
expect(response.status).toBe(400);
|
||||
});
|
||||
|
||||
it("should return 405 if the user is on the Hobby plan and has reached the maximum number of annotation queues", async () => {
|
||||
const { auth: hobbyPlanAuth, projectId: hobbyProjectId } =
|
||||
await createOrgProjectAndApiKey({
|
||||
plan: "Hobby",
|
||||
});
|
||||
|
||||
const config = await prisma.scoreConfig.create({
|
||||
data: {
|
||||
name: "Test Score Config",
|
||||
description: "Test Score Config Description",
|
||||
projectId: hobbyProjectId,
|
||||
dataType: "NUMERIC",
|
||||
},
|
||||
});
|
||||
|
||||
await prisma.annotationQueue.create({
|
||||
data: {
|
||||
name: "First queue",
|
||||
description: "First queue description",
|
||||
scoreConfigIds: [config.id],
|
||||
projectId: hobbyProjectId,
|
||||
},
|
||||
});
|
||||
|
||||
const response = await makeAPICall(
|
||||
"POST",
|
||||
"/api/public/annotation-queues",
|
||||
{
|
||||
name: "Hobby plan queue",
|
||||
description: "Test Queue Description",
|
||||
scoreConfigIds: [config.id],
|
||||
},
|
||||
hobbyPlanAuth,
|
||||
);
|
||||
|
||||
expect(response.status).toBe(405);
|
||||
});
|
||||
});
|
||||
|
||||
describe("GET /annotation-queues/:queueId", () => {
|
||||
it("should get a specific annotation queue", async () => {
|
||||
const response = await makeZodVerifiedAPICall(
|
||||
|
||||
@@ -0,0 +1,342 @@
|
||||
/** @jest-environment node */
|
||||
|
||||
import {
|
||||
makeZodVerifiedAPICall,
|
||||
makeAPICall,
|
||||
pruneDatabase,
|
||||
} from "@/src/__tests__/test-utils";
|
||||
import { prisma } from "@langfuse/shared/src/db";
|
||||
import { createOrgProjectAndApiKey } from "@langfuse/shared/src/server";
|
||||
import { v4 as uuidv4 } from "uuid";
|
||||
import {
|
||||
CreateAnnotationQueueAssignmentResponse,
|
||||
DeleteAnnotationQueueAssignmentResponse,
|
||||
} from "@/src/features/public-api/types/annotation-queues";
|
||||
|
||||
describe("/api/public/annotation-queues/:queueId/assignments API", () => {
|
||||
let auth: string;
|
||||
let projectId: string;
|
||||
let orgId: string;
|
||||
let queueId: string;
|
||||
let testUserId: string;
|
||||
let secondTestUserId: string;
|
||||
|
||||
beforeAll(async () => {
|
||||
const {
|
||||
auth: newAuth,
|
||||
projectId: newProjectId,
|
||||
orgId: newOrgId,
|
||||
} = await createOrgProjectAndApiKey();
|
||||
auth = newAuth;
|
||||
projectId = newProjectId;
|
||||
orgId = newOrgId;
|
||||
|
||||
// Create a test annotation queue
|
||||
const queue = await prisma.annotationQueue.create({
|
||||
data: {
|
||||
id: uuidv4(),
|
||||
name: "Test Queue for Assignments",
|
||||
description: "Test queue for assignment testing",
|
||||
projectId,
|
||||
scoreConfigIds: [],
|
||||
},
|
||||
});
|
||||
queueId = queue.id;
|
||||
|
||||
// Create test users with project access
|
||||
const testUser = await prisma.user.create({
|
||||
data: {
|
||||
id: uuidv4(),
|
||||
email: `testuser1-${uuidv4()}@example.com`,
|
||||
name: "Test User 1",
|
||||
},
|
||||
});
|
||||
testUserId = testUser.id;
|
||||
|
||||
const secondTestUser = await prisma.user.create({
|
||||
data: {
|
||||
id: uuidv4(),
|
||||
email: `testuser2-${uuidv4()}@example.com`,
|
||||
name: "Test User 2",
|
||||
},
|
||||
});
|
||||
secondTestUserId = secondTestUser.id;
|
||||
|
||||
// Give users project access - need to create org memberships first
|
||||
await prisma.organizationMembership.createMany({
|
||||
data: [
|
||||
{
|
||||
orgId,
|
||||
userId: testUserId,
|
||||
role: "MEMBER",
|
||||
},
|
||||
{
|
||||
orgId,
|
||||
userId: secondTestUserId,
|
||||
role: "MEMBER",
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
// Get the org membership IDs and create project memberships
|
||||
const orgMembership1 = await prisma.organizationMembership.findFirst({
|
||||
where: { orgId, userId: testUserId },
|
||||
});
|
||||
const orgMembership2 = await prisma.organizationMembership.findFirst({
|
||||
where: { orgId, userId: secondTestUserId },
|
||||
});
|
||||
|
||||
await prisma.projectMembership.createMany({
|
||||
data: [
|
||||
{
|
||||
projectId,
|
||||
userId: testUserId,
|
||||
role: "MEMBER",
|
||||
orgMembershipId: orgMembership1!.id,
|
||||
},
|
||||
{
|
||||
projectId,
|
||||
userId: secondTestUserId,
|
||||
role: "MEMBER",
|
||||
orgMembershipId: orgMembership2!.id,
|
||||
},
|
||||
],
|
||||
});
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
await pruneDatabase();
|
||||
});
|
||||
|
||||
describe("POST /api/public/annotation-queues/:queueId/assignments", () => {
|
||||
it("should create annotation queue assignment successfully", async () => {
|
||||
const response = await makeZodVerifiedAPICall(
|
||||
CreateAnnotationQueueAssignmentResponse,
|
||||
"POST",
|
||||
`/api/public/annotation-queues/${queueId}/assignments`,
|
||||
{
|
||||
userId: testUserId,
|
||||
},
|
||||
auth,
|
||||
);
|
||||
|
||||
expect(response.status).toBe(200);
|
||||
expect(response.body.userId).toBe(testUserId);
|
||||
expect(response.body.projectId).toBe(projectId);
|
||||
expect(response.body.queueId).toBe(queueId);
|
||||
|
||||
// Verify the membership was created in the database
|
||||
const assignment = await prisma.annotationQueueAssignment.findUnique({
|
||||
where: {
|
||||
projectId_queueId_userId: {
|
||||
projectId,
|
||||
queueId,
|
||||
userId: testUserId,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
expect(assignment).toBeTruthy();
|
||||
expect(assignment?.userId).toBe(testUserId);
|
||||
expect(assignment?.projectId).toBe(projectId);
|
||||
expect(assignment?.queueId).toBe(queueId);
|
||||
});
|
||||
|
||||
it("should handle duplicate assignment creation gracefully", async () => {
|
||||
// Create assignment first time
|
||||
await makeZodVerifiedAPICall(
|
||||
CreateAnnotationQueueAssignmentResponse,
|
||||
"POST",
|
||||
`/api/public/annotation-queues/${queueId}/assignments`,
|
||||
{
|
||||
userId: secondTestUserId,
|
||||
},
|
||||
auth,
|
||||
);
|
||||
|
||||
// Create same assignment again - should succeed (upsert behavior)
|
||||
const response = await makeZodVerifiedAPICall(
|
||||
CreateAnnotationQueueAssignmentResponse,
|
||||
"POST",
|
||||
`/api/public/annotation-queues/${queueId}/assignments`,
|
||||
{
|
||||
userId: secondTestUserId,
|
||||
},
|
||||
auth,
|
||||
);
|
||||
|
||||
expect(response.status).toBe(200);
|
||||
expect(response.body.userId).toBe(secondTestUserId);
|
||||
|
||||
// Verify only one assignment exists
|
||||
const assignments = await prisma.annotationQueueAssignment.findMany({
|
||||
where: {
|
||||
projectId,
|
||||
queueId,
|
||||
userId: secondTestUserId,
|
||||
},
|
||||
});
|
||||
|
||||
expect(assignments).toHaveLength(1);
|
||||
});
|
||||
|
||||
it("should return 404 for non-existent annotation queue", async () => {
|
||||
const nonExistentQueueId = uuidv4();
|
||||
|
||||
const response = await makeAPICall(
|
||||
"POST",
|
||||
`/api/public/annotation-queues/${nonExistentQueueId}/assignments`,
|
||||
{
|
||||
userId: testUserId,
|
||||
},
|
||||
auth,
|
||||
);
|
||||
|
||||
expect(response.status).toBe(404);
|
||||
});
|
||||
|
||||
it("should return 404 for non-existent user", async () => {
|
||||
const nonExistentUserId = uuidv4();
|
||||
|
||||
const response = await makeAPICall(
|
||||
"POST",
|
||||
`/api/public/annotation-queues/${queueId}/assignments`,
|
||||
{
|
||||
userId: nonExistentUserId,
|
||||
},
|
||||
auth,
|
||||
);
|
||||
|
||||
expect(response.status).toBe(404);
|
||||
});
|
||||
|
||||
it("should return 404 for user without project access", async () => {
|
||||
// Create a user without project access
|
||||
const userWithoutAccess = await prisma.user.create({
|
||||
data: {
|
||||
id: uuidv4(),
|
||||
email: `noaccess-${uuidv4()}@example.com`,
|
||||
name: "No Access User",
|
||||
},
|
||||
});
|
||||
|
||||
const response = await makeAPICall(
|
||||
"POST",
|
||||
`/api/public/annotation-queues/${queueId}/assignments`,
|
||||
{
|
||||
userId: userWithoutAccess.id,
|
||||
},
|
||||
auth,
|
||||
);
|
||||
|
||||
expect(response.status).toBe(404);
|
||||
});
|
||||
|
||||
it("should validate request body", async () => {
|
||||
// Missing userId
|
||||
const response = await makeAPICall(
|
||||
"POST",
|
||||
`/api/public/annotation-queues/${queueId}/assignments`,
|
||||
{},
|
||||
auth,
|
||||
);
|
||||
|
||||
expect(response.status).toBe(400);
|
||||
});
|
||||
|
||||
it("should require valid queueId format", async () => {
|
||||
const response = await makeAPICall(
|
||||
"POST",
|
||||
`/api/public/annotation-queues/invalid-queue-id/assignments`,
|
||||
{
|
||||
userId: testUserId,
|
||||
},
|
||||
auth,
|
||||
);
|
||||
|
||||
expect(response.status).toBe(404);
|
||||
});
|
||||
});
|
||||
|
||||
describe("DELETE /api/public/annotation-queues/:queueId/assignments", () => {
|
||||
beforeEach(async () => {
|
||||
// Ensure assignment exists for delete tests
|
||||
await prisma.annotationQueueAssignment.upsert({
|
||||
where: {
|
||||
projectId_queueId_userId: {
|
||||
projectId,
|
||||
queueId,
|
||||
userId: testUserId,
|
||||
},
|
||||
},
|
||||
create: {
|
||||
projectId,
|
||||
queueId,
|
||||
userId: testUserId,
|
||||
},
|
||||
update: {},
|
||||
});
|
||||
});
|
||||
|
||||
it("should delete annotation queue membership successfully", async () => {
|
||||
const response = await makeZodVerifiedAPICall(
|
||||
DeleteAnnotationQueueAssignmentResponse,
|
||||
"DELETE",
|
||||
`/api/public/annotation-queues/${queueId}/assignments`,
|
||||
{
|
||||
userId: testUserId,
|
||||
},
|
||||
auth,
|
||||
);
|
||||
|
||||
expect(response.status).toBe(200);
|
||||
expect(response.body.success).toBe(true);
|
||||
|
||||
// Verify the membership was deleted from the database
|
||||
const assignment = await prisma.annotationQueueAssignment.findUnique({
|
||||
where: {
|
||||
projectId_queueId_userId: {
|
||||
projectId,
|
||||
queueId,
|
||||
userId: testUserId,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
expect(assignment).toBeNull();
|
||||
});
|
||||
|
||||
it("should handle deletion of non-existent assignment gracefully", async () => {
|
||||
// Delete a assignment that doesn't exist
|
||||
const nonExistentUserId = uuidv4();
|
||||
|
||||
const response = await makeZodVerifiedAPICall(
|
||||
DeleteAnnotationQueueAssignmentResponse,
|
||||
"DELETE",
|
||||
`/api/public/annotation-queues/${queueId}/assignments`,
|
||||
{
|
||||
userId: nonExistentUserId,
|
||||
},
|
||||
auth,
|
||||
);
|
||||
|
||||
expect(response.status).toBe(200);
|
||||
expect(response.body.success).toBe(true);
|
||||
});
|
||||
|
||||
it("should return 404 for non-existent annotation queue", async () => {
|
||||
const nonExistentQueueId = uuidv4();
|
||||
|
||||
const response = await makeAPICall(
|
||||
"DELETE",
|
||||
`/api/public/annotation-queues/${nonExistentQueueId}/assignments`,
|
||||
{
|
||||
userId: testUserId,
|
||||
},
|
||||
auth,
|
||||
);
|
||||
|
||||
expect(response.status).toBe(404);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,443 @@
|
||||
/** @jest-environment node */
|
||||
|
||||
import { prisma } from "@langfuse/shared/src/db";
|
||||
import { Prisma, type Role } from "@langfuse/shared";
|
||||
import { v4 } from "uuid";
|
||||
import { getUserProjectRoles } from "@/src/features/rbac/utils/userProjectRole";
|
||||
|
||||
export const createOrgAndProject = async () => {
|
||||
const org = await prisma.organization.create({
|
||||
data: {
|
||||
id: v4(),
|
||||
name: v4(),
|
||||
},
|
||||
});
|
||||
|
||||
const project = await prisma.project.create({
|
||||
data: {
|
||||
id: v4(),
|
||||
name: v4(),
|
||||
orgId: org.id,
|
||||
},
|
||||
});
|
||||
|
||||
return { org, project };
|
||||
};
|
||||
|
||||
describe("find user project roles", () => {
|
||||
it("should find users with org role", async () => {
|
||||
const { org, project } = await createOrgAndProject();
|
||||
|
||||
const user = await prisma.user.create({
|
||||
data: {
|
||||
id: v4(),
|
||||
email: v4(),
|
||||
name: v4(),
|
||||
},
|
||||
});
|
||||
|
||||
await prisma.organizationMembership.create({
|
||||
data: {
|
||||
userId: user.id,
|
||||
orgId: org.id,
|
||||
role: "MEMBER",
|
||||
},
|
||||
});
|
||||
|
||||
const users = await getUserProjectRoles({
|
||||
projectId: project.id,
|
||||
orgId: org.id,
|
||||
filterCondition: [],
|
||||
searchFilter: Prisma.empty,
|
||||
orderBy: Prisma.empty,
|
||||
});
|
||||
|
||||
expect(users).toEqual([
|
||||
expect.objectContaining({
|
||||
id: user.id,
|
||||
name: user.name,
|
||||
email: user.email,
|
||||
}),
|
||||
]);
|
||||
});
|
||||
|
||||
it("should exclude users with NONE role", async () => {
|
||||
const { org, project } = await createOrgAndProject();
|
||||
|
||||
const user = await prisma.user.create({
|
||||
data: {
|
||||
id: v4(),
|
||||
email: v4(),
|
||||
name: v4(),
|
||||
},
|
||||
});
|
||||
|
||||
await prisma.organizationMembership.create({
|
||||
data: {
|
||||
userId: user.id,
|
||||
orgId: org.id,
|
||||
role: "NONE",
|
||||
},
|
||||
});
|
||||
|
||||
const users = await getUserProjectRoles({
|
||||
projectId: project.id,
|
||||
orgId: org.id,
|
||||
filterCondition: [],
|
||||
searchFilter: Prisma.empty,
|
||||
orderBy: Prisma.empty,
|
||||
});
|
||||
|
||||
expect(users).toEqual([]);
|
||||
});
|
||||
|
||||
it("should find users with org and project role", async () => {
|
||||
const { org, project } = await createOrgAndProject();
|
||||
|
||||
const user = await prisma.user.create({
|
||||
data: {
|
||||
id: v4(),
|
||||
email: v4(),
|
||||
name: v4(),
|
||||
},
|
||||
});
|
||||
|
||||
await prisma.organizationMembership.create({
|
||||
data: {
|
||||
userId: user.id,
|
||||
orgId: org.id,
|
||||
role: "MEMBER",
|
||||
},
|
||||
});
|
||||
const user2 = await prisma.user.create({
|
||||
data: {
|
||||
id: v4(),
|
||||
email: v4(),
|
||||
name: v4(),
|
||||
},
|
||||
});
|
||||
|
||||
const orgMembershipOfUser2 = await prisma.organizationMembership.create({
|
||||
data: {
|
||||
userId: user2.id,
|
||||
orgId: org.id,
|
||||
role: "MEMBER",
|
||||
},
|
||||
});
|
||||
|
||||
// overwrite org role to ADMIN
|
||||
await prisma.projectMembership.create({
|
||||
data: {
|
||||
userId: user2.id,
|
||||
projectId: project.id,
|
||||
role: "ADMIN",
|
||||
orgMembershipId: orgMembershipOfUser2.id,
|
||||
},
|
||||
});
|
||||
|
||||
const user3 = await prisma.user.create({
|
||||
data: {
|
||||
id: v4(),
|
||||
email: v4(),
|
||||
name: v4(),
|
||||
},
|
||||
});
|
||||
|
||||
const orgMembershipOfUser3 = await prisma.organizationMembership.create({
|
||||
data: {
|
||||
userId: user3.id,
|
||||
orgId: org.id,
|
||||
role: "ADMIN",
|
||||
},
|
||||
});
|
||||
|
||||
// Downgrade org role to VIEWER
|
||||
await prisma.projectMembership.create({
|
||||
data: {
|
||||
userId: user3.id,
|
||||
projectId: project.id,
|
||||
role: "VIEWER",
|
||||
orgMembershipId: orgMembershipOfUser3.id,
|
||||
},
|
||||
});
|
||||
|
||||
const users = await getUserProjectRoles({
|
||||
projectId: project.id,
|
||||
orgId: org.id,
|
||||
filterCondition: [],
|
||||
searchFilter: Prisma.empty,
|
||||
orderBy: Prisma.empty,
|
||||
});
|
||||
|
||||
expect(users).toEqual(
|
||||
expect.arrayContaining([
|
||||
expect.objectContaining({
|
||||
id: user.id,
|
||||
name: user.name,
|
||||
email: user.email,
|
||||
role: "MEMBER",
|
||||
}),
|
||||
expect.objectContaining({
|
||||
id: user2.id,
|
||||
name: user2.name,
|
||||
email: user2.email,
|
||||
role: "ADMIN",
|
||||
}),
|
||||
expect.objectContaining({
|
||||
id: user3.id,
|
||||
name: user3.name,
|
||||
email: user3.email,
|
||||
role: "VIEWER",
|
||||
}),
|
||||
]),
|
||||
);
|
||||
});
|
||||
|
||||
it("should not select users from different projects", async () => {
|
||||
const { org, project } = await createOrgAndProject();
|
||||
|
||||
// valid user
|
||||
const user = await prisma.user.create({
|
||||
data: {
|
||||
id: v4(),
|
||||
email: v4(),
|
||||
name: v4(),
|
||||
},
|
||||
});
|
||||
|
||||
await prisma.organizationMembership.create({
|
||||
data: {
|
||||
userId: user.id,
|
||||
orgId: org.id,
|
||||
role: "MEMBER",
|
||||
},
|
||||
});
|
||||
|
||||
const { org: org2, project: project2 } = await createOrgAndProject();
|
||||
|
||||
const user2 = await prisma.user.create({
|
||||
data: {
|
||||
id: v4(),
|
||||
email: v4(),
|
||||
name: v4(),
|
||||
},
|
||||
});
|
||||
|
||||
await prisma.organizationMembership.create({
|
||||
data: {
|
||||
userId: user2.id,
|
||||
orgId: org2.id,
|
||||
role: "MEMBER",
|
||||
},
|
||||
});
|
||||
|
||||
const user3 = await prisma.user.create({
|
||||
data: {
|
||||
id: v4(),
|
||||
email: v4(),
|
||||
name: v4(),
|
||||
},
|
||||
});
|
||||
|
||||
const orgMembershipOfUser3 = await prisma.organizationMembership.create({
|
||||
data: {
|
||||
userId: user3.id,
|
||||
orgId: org2.id,
|
||||
role: "MEMBER",
|
||||
},
|
||||
});
|
||||
|
||||
await prisma.projectMembership.create({
|
||||
data: {
|
||||
userId: user3.id,
|
||||
projectId: project2.id,
|
||||
role: "MEMBER",
|
||||
orgMembershipId: orgMembershipOfUser3.id,
|
||||
},
|
||||
});
|
||||
|
||||
const users = await getUserProjectRoles({
|
||||
projectId: project.id,
|
||||
orgId: org.id,
|
||||
filterCondition: [],
|
||||
searchFilter: Prisma.empty,
|
||||
orderBy: Prisma.empty,
|
||||
});
|
||||
|
||||
expect(users).toEqual([
|
||||
expect.objectContaining({
|
||||
id: user.id,
|
||||
name: user.name,
|
||||
email: user.email,
|
||||
}),
|
||||
]);
|
||||
});
|
||||
|
||||
it("should return empty array for empty organization", async () => {
|
||||
const { org, project } = await createOrgAndProject();
|
||||
|
||||
const users = await getUserProjectRoles({
|
||||
projectId: project.id,
|
||||
orgId: org.id,
|
||||
filterCondition: [],
|
||||
searchFilter: Prisma.empty,
|
||||
orderBy: Prisma.empty,
|
||||
});
|
||||
|
||||
expect(users).toEqual([]);
|
||||
});
|
||||
|
||||
it("should exclude users with project role NONE even if they have org membership", async () => {
|
||||
const { org, project } = await createOrgAndProject();
|
||||
|
||||
const user = await prisma.user.create({
|
||||
data: {
|
||||
id: v4(),
|
||||
email: v4(),
|
||||
name: v4(),
|
||||
},
|
||||
});
|
||||
|
||||
const orgMembership = await prisma.organizationMembership.create({
|
||||
data: {
|
||||
userId: user.id,
|
||||
orgId: org.id,
|
||||
role: "ADMIN",
|
||||
},
|
||||
});
|
||||
|
||||
// Project role NONE should exclude user despite ADMIN org role
|
||||
await prisma.projectMembership.create({
|
||||
data: {
|
||||
userId: user.id,
|
||||
projectId: project.id,
|
||||
role: "NONE",
|
||||
orgMembershipId: orgMembership.id,
|
||||
},
|
||||
});
|
||||
|
||||
const users = await getUserProjectRoles({
|
||||
projectId: project.id,
|
||||
orgId: org.id,
|
||||
filterCondition: [],
|
||||
searchFilter: Prisma.empty,
|
||||
orderBy: Prisma.empty,
|
||||
});
|
||||
|
||||
expect(users).toEqual([]);
|
||||
});
|
||||
|
||||
it("should test all role combinations inheritance vs override", async () => {
|
||||
const { org, project } = await createOrgAndProject();
|
||||
|
||||
// Test inheritance: users with only org roles
|
||||
const inheritanceTests = [
|
||||
{ orgRole: "OWNER", expectedRole: "OWNER" },
|
||||
{ orgRole: "ADMIN", expectedRole: "ADMIN" },
|
||||
{ orgRole: "MEMBER", expectedRole: "MEMBER" },
|
||||
{ orgRole: "VIEWER", expectedRole: "VIEWER" },
|
||||
];
|
||||
|
||||
const inheritanceUsers = [];
|
||||
for (const test of inheritanceTests) {
|
||||
const id = v4();
|
||||
const user = await prisma.user.create({
|
||||
data: {
|
||||
id,
|
||||
email: `${id}-${test.orgRole}@test.com`,
|
||||
name: `${id}-${test.orgRole} User`,
|
||||
},
|
||||
});
|
||||
|
||||
await prisma.organizationMembership.create({
|
||||
data: {
|
||||
userId: user.id,
|
||||
orgId: org.id,
|
||||
role: test.orgRole as Role,
|
||||
},
|
||||
});
|
||||
|
||||
inheritanceUsers.push({
|
||||
id,
|
||||
role: test.expectedRole,
|
||||
});
|
||||
}
|
||||
|
||||
// Test overrides: users with project roles that override org roles
|
||||
const overrideTests = [
|
||||
{ orgRole: "OWNER", projectRole: "VIEWER", expectedRole: "VIEWER" },
|
||||
{ orgRole: "MEMBER", projectRole: "ADMIN", expectedRole: "ADMIN" },
|
||||
{ orgRole: "VIEWER", projectRole: "MEMBER", expectedRole: "MEMBER" },
|
||||
{ orgRole: "ADMIN", projectRole: "VIEWER", expectedRole: "VIEWER" },
|
||||
];
|
||||
|
||||
const overrideUsers = [];
|
||||
for (const test of overrideTests) {
|
||||
const id = v4();
|
||||
const user = await prisma.user.create({
|
||||
data: {
|
||||
id,
|
||||
email: `${id}-${test.orgRole}-${test.projectRole}@test.com`,
|
||||
name: `${id}-${test.orgRole}-${test.projectRole} User`,
|
||||
},
|
||||
});
|
||||
|
||||
const orgMembership = await prisma.organizationMembership.create({
|
||||
data: {
|
||||
userId: user.id,
|
||||
orgId: org.id,
|
||||
role: test.orgRole as Role,
|
||||
},
|
||||
});
|
||||
|
||||
await prisma.projectMembership.create({
|
||||
data: {
|
||||
userId: user.id,
|
||||
projectId: project.id,
|
||||
role: test.projectRole as Role,
|
||||
orgMembershipId: orgMembership.id,
|
||||
},
|
||||
});
|
||||
|
||||
overrideUsers.push({
|
||||
id: user.id,
|
||||
role: test.expectedRole,
|
||||
});
|
||||
}
|
||||
|
||||
const users = await getUserProjectRoles({
|
||||
projectId: project.id,
|
||||
orgId: org.id,
|
||||
filterCondition: [],
|
||||
searchFilter: Prisma.empty,
|
||||
orderBy: Prisma.empty,
|
||||
});
|
||||
|
||||
// Verify all inheritance cases
|
||||
for (const expectedUser of inheritanceUsers) {
|
||||
expect(users).toEqual(
|
||||
expect.arrayContaining([
|
||||
expect.objectContaining({
|
||||
id: expectedUser.id,
|
||||
role: expectedUser.role,
|
||||
}),
|
||||
]),
|
||||
);
|
||||
}
|
||||
|
||||
// Verify all override cases
|
||||
for (const expectedUser of overrideUsers) {
|
||||
expect(users).toEqual(
|
||||
expect.arrayContaining([
|
||||
expect.objectContaining({
|
||||
id: expectedUser.id,
|
||||
role: expectedUser.role,
|
||||
}),
|
||||
]),
|
||||
);
|
||||
}
|
||||
|
||||
// Verify total count
|
||||
expect(users).toHaveLength(inheritanceUsers.length + overrideUsers.length);
|
||||
});
|
||||
});
|
||||
@@ -205,6 +205,162 @@ describe("/api/public/ingestion API Endpoint", () => {
|
||||
},
|
||||
},
|
||||
],
|
||||
[
|
||||
"agent",
|
||||
"AGENT",
|
||||
{
|
||||
id: randomUUID(),
|
||||
type: "agent-create",
|
||||
timestamp: new Date().toISOString(),
|
||||
body: {
|
||||
id: randomUUID(),
|
||||
traceId: randomUUID(),
|
||||
startTime: new Date().toISOString(),
|
||||
endTime: new Date(Date.now() + 1000).toISOString(),
|
||||
name: "AI Agent",
|
||||
input: "Process user request",
|
||||
output: "Request processed successfully",
|
||||
model: "claude-3-haiku",
|
||||
modelParameters: { temperature: 0.7, max_tokens: 1000 },
|
||||
usage: {
|
||||
input: 150,
|
||||
output: 75,
|
||||
total: 225,
|
||||
unit: "TOKENS",
|
||||
inputCost: 0.0015,
|
||||
outputCost: 0.003,
|
||||
totalCost: 0.0045,
|
||||
},
|
||||
usageDetails: { input: 150, output: 75, total: 225 },
|
||||
costDetails: { input: 0.0015, output: 0.003, total: 0.0045 },
|
||||
},
|
||||
},
|
||||
],
|
||||
[
|
||||
"tool",
|
||||
"TOOL",
|
||||
{
|
||||
id: randomUUID(),
|
||||
type: "tool-create",
|
||||
timestamp: new Date().toISOString(),
|
||||
body: {
|
||||
id: randomUUID(),
|
||||
traceId: randomUUID(),
|
||||
startTime: new Date().toISOString(),
|
||||
endTime: new Date(Date.now() + 2000).toISOString(),
|
||||
name: "Web Search Tool",
|
||||
input: "Search for current weather",
|
||||
output: "Weather data retrieved",
|
||||
model: "gpt-4o-mini",
|
||||
usage: {
|
||||
input: 50,
|
||||
output: 25,
|
||||
total: 75,
|
||||
unit: "TOKENS",
|
||||
inputCost: 0.0001,
|
||||
outputCost: 0.0002,
|
||||
totalCost: 0.0003,
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
[
|
||||
"chain",
|
||||
"CHAIN",
|
||||
{
|
||||
id: randomUUID(),
|
||||
type: "chain-create",
|
||||
timestamp: new Date().toISOString(),
|
||||
body: {
|
||||
id: randomUUID(),
|
||||
traceId: randomUUID(),
|
||||
startTime: new Date().toISOString(),
|
||||
endTime: new Date(Date.now() + 3000).toISOString(),
|
||||
name: "Processing Chain",
|
||||
input: "Multi-step task",
|
||||
output: "All steps completed",
|
||||
model: "gpt-4",
|
||||
usageDetails: { input: 800, output: 400, total: 1200 },
|
||||
costDetails: { input: 0.024, output: 0.048, total: 0.072 },
|
||||
},
|
||||
},
|
||||
],
|
||||
[
|
||||
"retriever",
|
||||
"RETRIEVER",
|
||||
{
|
||||
id: randomUUID(),
|
||||
type: "retriever-create",
|
||||
timestamp: new Date().toISOString(),
|
||||
body: {
|
||||
id: randomUUID(),
|
||||
traceId: randomUUID(),
|
||||
startTime: new Date().toISOString(),
|
||||
endTime: new Date(Date.now() + 1500).toISOString(),
|
||||
name: "Document Retriever",
|
||||
input: "Query document database",
|
||||
output: "Retrieved 5 relevant documents",
|
||||
},
|
||||
},
|
||||
],
|
||||
[
|
||||
"evaluator",
|
||||
"EVALUATOR",
|
||||
{
|
||||
id: randomUUID(),
|
||||
type: "evaluator-create",
|
||||
timestamp: new Date().toISOString(),
|
||||
body: {
|
||||
id: randomUUID(),
|
||||
traceId: randomUUID(),
|
||||
startTime: new Date().toISOString(),
|
||||
endTime: new Date(Date.now() + 800).toISOString(),
|
||||
name: "Quality Evaluator",
|
||||
input: "Evaluate response quality",
|
||||
output: "Quality score: 0.85",
|
||||
},
|
||||
},
|
||||
],
|
||||
[
|
||||
"embedding",
|
||||
"EMBEDDING",
|
||||
{
|
||||
id: randomUUID(),
|
||||
type: "embedding-create",
|
||||
timestamp: new Date().toISOString(),
|
||||
body: {
|
||||
id: randomUUID(),
|
||||
traceId: randomUUID(),
|
||||
startTime: new Date().toISOString(),
|
||||
endTime: new Date(Date.now() + 500).toISOString(),
|
||||
name: "Text Embedding",
|
||||
input: "Text to embed",
|
||||
output: "Embedding vector generated",
|
||||
model: "text-embedding-ada-002",
|
||||
usage: {
|
||||
input: 20,
|
||||
output: 0,
|
||||
total: 20,
|
||||
unit: "TOKENS",
|
||||
totalCost: 0.00004,
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
[
|
||||
"guardrail",
|
||||
"GUARDRAIL",
|
||||
{
|
||||
id: randomUUID(),
|
||||
type: "guardrail-create",
|
||||
timestamp: new Date().toISOString(),
|
||||
body: {
|
||||
id: randomUUID(),
|
||||
traceId: randomUUID(),
|
||||
startTime: new Date().toISOString(),
|
||||
},
|
||||
},
|
||||
],
|
||||
])(
|
||||
"should create observations via the ingestion API (%s)",
|
||||
async (_name: string, type: string, entity: any) => {
|
||||
|
||||
@@ -281,6 +281,81 @@ describe("Memberships APIs", () => {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("DELETE /api/public/projects/[projectId]/memberships", () => {
|
||||
it("should delete an existing project membership with valid API key", async () => {
|
||||
// First ensure the user has an organization membership
|
||||
const orgMembership = await prisma.organizationMembership.upsert({
|
||||
where: {
|
||||
orgId_userId: {
|
||||
userId: testUserId,
|
||||
orgId: testOrgId,
|
||||
},
|
||||
},
|
||||
update: {},
|
||||
create: {
|
||||
userId: testUserId,
|
||||
orgId: testOrgId,
|
||||
role: Role.MEMBER,
|
||||
},
|
||||
});
|
||||
|
||||
// Create a project membership
|
||||
await prisma.projectMembership.upsert({
|
||||
where: {
|
||||
projectId_userId: {
|
||||
userId: testUserId,
|
||||
projectId: testProjectId,
|
||||
},
|
||||
},
|
||||
update: {},
|
||||
create: {
|
||||
userId: testUserId,
|
||||
projectId: testProjectId,
|
||||
role: Role.VIEWER,
|
||||
orgMembershipId: orgMembership.id,
|
||||
},
|
||||
});
|
||||
|
||||
// Verify membership exists before deletion
|
||||
const membershipBefore = await prisma.projectMembership.findUnique({
|
||||
where: {
|
||||
projectId_userId: {
|
||||
userId: testUserId,
|
||||
projectId: testProjectId,
|
||||
},
|
||||
},
|
||||
});
|
||||
expect(membershipBefore).not.toBeNull();
|
||||
|
||||
// Delete the membership
|
||||
const response = await makeAPICall(
|
||||
"DELETE",
|
||||
`/api/public/projects/${testProjectId}/memberships`,
|
||||
{
|
||||
userId: testUserId,
|
||||
},
|
||||
createBasicAuthHeader(testApiKey, testApiSecretKey),
|
||||
);
|
||||
|
||||
expect(response.status).toBe(200);
|
||||
expect(response.body.message).toBe(
|
||||
"Project membership deleted successfully",
|
||||
);
|
||||
expect(response.body.userId).toBe(testUserId);
|
||||
|
||||
// Verify the membership was deleted from the database
|
||||
const membershipAfter = await prisma.projectMembership.findUnique({
|
||||
where: {
|
||||
projectId_userId: {
|
||||
userId: testUserId,
|
||||
projectId: testProjectId,
|
||||
},
|
||||
},
|
||||
});
|
||||
expect(membershipAfter).toBeNull();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("Organization Memberships", () => {
|
||||
@@ -404,5 +479,63 @@ describe("Memberships APIs", () => {
|
||||
expect(result.status).toBe(404);
|
||||
});
|
||||
});
|
||||
|
||||
describe("DELETE /api/public/organizations/memberships", () => {
|
||||
it("should delete an existing organization membership with valid API key", async () => {
|
||||
// First ensure the membership exists
|
||||
await prisma.organizationMembership.upsert({
|
||||
where: {
|
||||
orgId_userId: {
|
||||
userId: testUserId,
|
||||
orgId: testOrgId,
|
||||
},
|
||||
},
|
||||
update: {},
|
||||
create: {
|
||||
userId: testUserId,
|
||||
orgId: testOrgId,
|
||||
role: Role.MEMBER,
|
||||
},
|
||||
});
|
||||
|
||||
// Verify membership exists before deletion
|
||||
const membershipBefore = await prisma.organizationMembership.findUnique(
|
||||
{
|
||||
where: {
|
||||
orgId_userId: {
|
||||
userId: testUserId,
|
||||
orgId: testOrgId,
|
||||
},
|
||||
},
|
||||
},
|
||||
);
|
||||
expect(membershipBefore).not.toBeNull();
|
||||
|
||||
// Delete the membership
|
||||
const response = await makeAPICall(
|
||||
"DELETE",
|
||||
`/api/public/organizations/memberships`,
|
||||
{
|
||||
userId: testUserId,
|
||||
},
|
||||
createBasicAuthHeader(testApiKey, testApiSecretKey),
|
||||
);
|
||||
|
||||
expect(response.status).toBe(200);
|
||||
expect(response.body.message).toBe("Membership deleted successfully");
|
||||
expect(response.body.userId).toBe(testUserId);
|
||||
|
||||
// Verify the membership was deleted from the database
|
||||
const membershipAfter = await prisma.organizationMembership.findUnique({
|
||||
where: {
|
||||
orgId_userId: {
|
||||
userId: testUserId,
|
||||
orgId: testOrgId,
|
||||
},
|
||||
},
|
||||
});
|
||||
expect(membershipAfter).toBeNull();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -497,4 +497,137 @@ describe("/api/public/metrics API Endpoint", () => {
|
||||
expect(height).toBeGreaterThanOrEqual(0);
|
||||
});
|
||||
});
|
||||
|
||||
describe("LFE-6148: Comprehensive filter validation", () => {
|
||||
it("should return 400 error for invalid array field filters", async () => {
|
||||
// Test using string type on array field (tags) - should return validation error
|
||||
const invalidStringTypeQuery = {
|
||||
view: "traces",
|
||||
dimensions: [{ field: "name" }],
|
||||
metrics: [{ measure: "count", aggregation: "count" }],
|
||||
filters: [
|
||||
{
|
||||
column: "tags",
|
||||
operator: "contains",
|
||||
value: "test-tag",
|
||||
type: "string", // Invalid: array fields require arrayOptions type
|
||||
},
|
||||
],
|
||||
timeDimension: {
|
||||
granularity: "day",
|
||||
},
|
||||
fromTimestamp: yesterday.toISOString(),
|
||||
toTimestamp: tomorrow.toISOString(),
|
||||
orderBy: null,
|
||||
};
|
||||
|
||||
// Make API call and expect 400 error
|
||||
const response = await makeAPICall(
|
||||
"GET",
|
||||
`/api/public/metrics?query=${encodeURIComponent(JSON.stringify(invalidStringTypeQuery))}`,
|
||||
);
|
||||
|
||||
expect(response.status).toBe(400);
|
||||
expect(response.body).toMatchObject({
|
||||
error: "InvalidRequestError",
|
||||
message: expect.stringContaining(
|
||||
"Array fields require type 'arrayOptions', not 'string'",
|
||||
),
|
||||
});
|
||||
});
|
||||
|
||||
it("should return 400 error for invalid metadata filters", async () => {
|
||||
// Test using wrong type for metadata field
|
||||
const invalidMetadataTypeQuery = {
|
||||
view: "traces",
|
||||
dimensions: [{ field: "name" }],
|
||||
metrics: [{ measure: "count", aggregation: "count" }],
|
||||
filters: [
|
||||
{
|
||||
column: "metadata",
|
||||
operator: "contains",
|
||||
value: "test-value",
|
||||
type: "string", // Invalid: metadata requires stringObject type
|
||||
},
|
||||
],
|
||||
timeDimension: null,
|
||||
fromTimestamp: yesterday.toISOString(),
|
||||
toTimestamp: tomorrow.toISOString(),
|
||||
orderBy: null,
|
||||
};
|
||||
|
||||
const response = await makeAPICall(
|
||||
"GET",
|
||||
`/api/public/metrics?query=${encodeURIComponent(JSON.stringify(invalidMetadataTypeQuery))}`,
|
||||
);
|
||||
|
||||
expect(response.status).toBe(400);
|
||||
expect(response.body).toMatchObject({
|
||||
error: "InvalidRequestError",
|
||||
message: expect.stringContaining(
|
||||
"Metadata filters require type 'stringObject'",
|
||||
),
|
||||
});
|
||||
});
|
||||
|
||||
it("should work correctly with proper array field filter configuration", async () => {
|
||||
// Setup test data with tags
|
||||
const taggedTraceId = randomUUID();
|
||||
await createTracesCh([
|
||||
createTrace({
|
||||
id: taggedTraceId,
|
||||
name: "tagged-trace",
|
||||
project_id: projectId,
|
||||
timestamp: now.getTime(),
|
||||
tags: ["test-tag", "another-tag"],
|
||||
metadata: { test: testMetadataValue },
|
||||
}),
|
||||
]);
|
||||
|
||||
// Test with correct arrayOptions filter
|
||||
const validQuery = {
|
||||
view: "traces",
|
||||
dimensions: [{ field: "name" }],
|
||||
metrics: [{ measure: "count", aggregation: "count" }],
|
||||
filters: [
|
||||
{
|
||||
column: "tags",
|
||||
operator: "any of", // Correct operator for array fields
|
||||
value: ["test-tag"],
|
||||
type: "arrayOptions", // Correct type for array fields
|
||||
},
|
||||
{
|
||||
column: "metadata",
|
||||
operator: "contains",
|
||||
key: "test",
|
||||
value: testMetadataValue,
|
||||
type: "stringObject",
|
||||
},
|
||||
],
|
||||
timeDimension: null,
|
||||
fromTimestamp: yesterday.toISOString(),
|
||||
toTimestamp: tomorrow.toISOString(),
|
||||
orderBy: null,
|
||||
};
|
||||
|
||||
// Make the API call
|
||||
const response = await makeZodVerifiedAPICall(
|
||||
GetMetricsV1Response,
|
||||
"GET",
|
||||
`/api/public/metrics?query=${encodeURIComponent(JSON.stringify(validQuery))}`,
|
||||
);
|
||||
|
||||
// Should succeed and return data
|
||||
expect(response.status).toBe(200);
|
||||
expect(Array.isArray(response.body.data)).toBe(true);
|
||||
expect(response.body.data.length).toBeGreaterThan(0);
|
||||
|
||||
// Verify we got the tagged trace
|
||||
const taggedTraceResult = response.body.data.find(
|
||||
(row: any) => row.name === "tagged-trace",
|
||||
);
|
||||
expect(taggedTraceResult).toBeDefined();
|
||||
expect(taggedTraceResult.count_count).toBe("1");
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -45,6 +45,41 @@ describe("/api/public/observations API Endpoint", () => {
|
||||
output: observation.output,
|
||||
});
|
||||
});
|
||||
|
||||
it.each([
|
||||
["AGENT", "agent-observation"],
|
||||
["TOOL", "tool-observation"],
|
||||
["CHAIN", "chain-observation"],
|
||||
["RETRIEVER", "retriever-observation"],
|
||||
["EVALUATOR", "evaluator-observation"],
|
||||
["EMBEDDING", "embedding-observation"],
|
||||
["GUARDRAIL", "guardrail-observation"],
|
||||
])("should GET observation with type %s", async (type, name) => {
|
||||
const observationId = uuidv4();
|
||||
const traceId = uuidv4();
|
||||
|
||||
const observation = createObservationObject({
|
||||
id: observationId,
|
||||
project_id: projectId,
|
||||
trace_id: traceId,
|
||||
type: type,
|
||||
name: name,
|
||||
});
|
||||
|
||||
await createObservationsInClickhouse([observation]);
|
||||
|
||||
const getEventRes = await makeZodVerifiedAPICall(
|
||||
GetObservationV1Response,
|
||||
"GET",
|
||||
"/api/public/observations/" + observationId,
|
||||
);
|
||||
expect(getEventRes.body).toMatchObject({
|
||||
id: observationId,
|
||||
traceId: traceId,
|
||||
type: type,
|
||||
name: name,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("GET /api/public/observations", () => {
|
||||
|
||||
@@ -66,6 +66,98 @@ describe("/api/public/observations API Endpoint", () => {
|
||||
input: "User action recorded",
|
||||
metadata: { eventType: "click", target: "submit-button" },
|
||||
}),
|
||||
createObservation({
|
||||
id: randomUUID(),
|
||||
trace_id: traceId,
|
||||
project_id: projectId,
|
||||
name: "agent-observation",
|
||||
type: "AGENT",
|
||||
level: "DEFAULT",
|
||||
start_time: timestamp.getTime() + 2000,
|
||||
end_time: timestamp.getTime() + 2500,
|
||||
provided_model_name: "claude-3-haiku",
|
||||
provided_usage_details: { input: 100, output: 50, total: 150 },
|
||||
provided_cost_details: { input: 0.001, output: 0.002, total: 0.003 },
|
||||
}),
|
||||
createObservation({
|
||||
id: randomUUID(),
|
||||
trace_id: traceId,
|
||||
project_id: projectId,
|
||||
name: "tool-observation",
|
||||
type: "TOOL",
|
||||
level: "DEFAULT",
|
||||
start_time: timestamp.getTime() + 2500,
|
||||
end_time: timestamp.getTime() + 3000,
|
||||
input: "Search web for information",
|
||||
output: "Found relevant results",
|
||||
provided_model_name: "gpt-4o-mini",
|
||||
provided_usage_details: { input: 200, output: 100, total: 300 },
|
||||
provided_cost_details: { input: 0.002, output: 0.004, total: 0.006 },
|
||||
}),
|
||||
createObservation({
|
||||
id: randomUUID(),
|
||||
trace_id: traceId,
|
||||
project_id: projectId,
|
||||
name: "chain-observation",
|
||||
type: "CHAIN",
|
||||
level: "DEFAULT",
|
||||
start_time: timestamp.getTime() + 3000,
|
||||
end_time: timestamp.getTime() + 3500,
|
||||
input: "Process multi-step workflow",
|
||||
output: "Workflow completed",
|
||||
provided_model_name: "gpt-4",
|
||||
provided_usage_details: { input: 500, output: 300, total: 800 },
|
||||
provided_cost_details: { input: 0.015, output: 0.03, total: 0.045 },
|
||||
}),
|
||||
createObservation({
|
||||
id: randomUUID(),
|
||||
trace_id: traceId,
|
||||
project_id: projectId,
|
||||
name: "retriever-observation",
|
||||
type: "RETRIEVER",
|
||||
level: "DEFAULT",
|
||||
start_time: timestamp.getTime() + 3500,
|
||||
end_time: timestamp.getTime() + 4000,
|
||||
input: "Query document database",
|
||||
output: "Retrieved 5 relevant documents",
|
||||
}),
|
||||
createObservation({
|
||||
id: randomUUID(),
|
||||
trace_id: traceId,
|
||||
project_id: projectId,
|
||||
name: "evaluator-observation",
|
||||
type: "EVALUATOR",
|
||||
level: "DEFAULT",
|
||||
start_time: timestamp.getTime() + 4000,
|
||||
input: null,
|
||||
output: null,
|
||||
end_time: null,
|
||||
}),
|
||||
createObservation({
|
||||
id: randomUUID(),
|
||||
trace_id: traceId,
|
||||
project_id: projectId,
|
||||
name: "embedding-observation",
|
||||
type: "EMBEDDING",
|
||||
level: "DEFAULT",
|
||||
start_time: timestamp.getTime() + 4500,
|
||||
end_time: timestamp.getTime() + 4750,
|
||||
input: "Text to embed",
|
||||
output: "Vector embedding generated",
|
||||
provided_model_name: "text-embedding-ada-002",
|
||||
provided_usage_details: { input: 10, output: 0, total: 10 },
|
||||
provided_cost_details: { input: 0.0001, output: 0, total: 0.0001 },
|
||||
}),
|
||||
createObservation({
|
||||
id: randomUUID(),
|
||||
trace_id: traceId,
|
||||
project_id: projectId,
|
||||
name: "guardrail-observation",
|
||||
type: "GUARDRAIL",
|
||||
level: "DEFAULT",
|
||||
start_time: timestamp.getTime() + 5000,
|
||||
provided_cost_details: { input: 0.0001, output: 0, total: 0.0001 },
|
||||
}),
|
||||
];
|
||||
|
||||
await createTracesCh([createdTrace]);
|
||||
@@ -80,14 +172,14 @@ describe("/api/public/observations API Endpoint", () => {
|
||||
expect(response.status).toBe(200);
|
||||
expect(response.body.data).toBeDefined();
|
||||
expect(response.body.meta).toBeDefined();
|
||||
expect(response.body.meta.totalItems).toBeGreaterThanOrEqual(3);
|
||||
expect(response.body.data.length).toBeGreaterThanOrEqual(3);
|
||||
expect(response.body.meta.totalItems).toBeGreaterThanOrEqual(10);
|
||||
expect(response.body.data.length).toBeGreaterThanOrEqual(10);
|
||||
|
||||
// Find our created observations in the response
|
||||
const createdObservations = response.body.data.filter(
|
||||
(obs) => obs.traceId === traceId,
|
||||
);
|
||||
expect(createdObservations.length).toBe(3);
|
||||
expect(createdObservations.length).toBe(10);
|
||||
|
||||
// Verify data structure and content
|
||||
const generationObs = createdObservations.find(
|
||||
@@ -118,6 +210,75 @@ describe("/api/public/observations API Endpoint", () => {
|
||||
eventType: "click",
|
||||
target: "submit-button",
|
||||
});
|
||||
|
||||
// Verify new observation types exist and have correct type
|
||||
const agentObs = createdObservations.find((obs) => obs.type === "AGENT");
|
||||
expect(agentObs).toBeDefined();
|
||||
expect(agentObs?.name).toBe("agent-observation");
|
||||
|
||||
const toolObs = createdObservations.find((obs) => obs.type === "TOOL");
|
||||
expect(toolObs).toBeDefined();
|
||||
expect(toolObs?.name).toBe("tool-observation");
|
||||
|
||||
const chainObs = createdObservations.find((obs) => obs.type === "CHAIN");
|
||||
expect(chainObs).toBeDefined();
|
||||
expect(chainObs?.name).toBe("chain-observation");
|
||||
|
||||
const retrieverObs = createdObservations.find(
|
||||
(obs) => obs.type === "RETRIEVER",
|
||||
);
|
||||
expect(retrieverObs).toBeDefined();
|
||||
expect(retrieverObs?.name).toBe("retriever-observation");
|
||||
|
||||
const evaluatorObs = createdObservations.find(
|
||||
(obs) => obs.type === "EVALUATOR",
|
||||
);
|
||||
expect(evaluatorObs).toBeDefined();
|
||||
expect(evaluatorObs?.name).toBe("evaluator-observation");
|
||||
// Test that input, output, and endTime can be null (optional fields)
|
||||
expect(evaluatorObs?.input).toBeNull();
|
||||
expect(evaluatorObs?.output).toBeNull();
|
||||
expect(evaluatorObs?.endTime).toBeNull();
|
||||
|
||||
const embeddingObs = createdObservations.find(
|
||||
(obs) => obs.type === "EMBEDDING",
|
||||
);
|
||||
expect(embeddingObs).toBeDefined();
|
||||
expect(embeddingObs?.name).toBe("embedding-observation");
|
||||
|
||||
const guardrailObs = createdObservations.find(
|
||||
(obs) => obs.type === "GUARDRAIL",
|
||||
);
|
||||
expect(guardrailObs).toBeDefined();
|
||||
expect(guardrailObs?.name).toBe("guardrail-observation");
|
||||
|
||||
// Verify new observation types support model and cost attributes
|
||||
// The key verification is that new observation types now have model and cost fields populated
|
||||
// (even if with default values from the factory, proving the schema changes work)
|
||||
expect(agentObs?.model).toBe("claude-3-haiku");
|
||||
expect(agentObs?.input).toBe("Hello World");
|
||||
expect(agentObs?.output).toBe("Hello John");
|
||||
// Verify that model/cost fields are present (core functionality test)
|
||||
expect(agentObs?.usageDetails).toBeDefined();
|
||||
expect(agentObs?.costDetails).toBeDefined();
|
||||
|
||||
expect(toolObs?.model).toBe("gpt-4o-mini");
|
||||
expect(toolObs?.input).toBe("Search web for information");
|
||||
expect(toolObs?.output).toBe("Found relevant results");
|
||||
expect(toolObs?.usageDetails).toBeDefined();
|
||||
expect(toolObs?.costDetails).toBeDefined();
|
||||
|
||||
expect(chainObs?.model).toBe("gpt-4");
|
||||
expect(chainObs?.input).toBe("Process multi-step workflow");
|
||||
expect(chainObs?.output).toBe("Workflow completed");
|
||||
expect(chainObs?.usageDetails).toBeDefined();
|
||||
expect(chainObs?.costDetails).toBeDefined();
|
||||
|
||||
expect(embeddingObs?.model).toBe("text-embedding-ada-002");
|
||||
expect(embeddingObs?.input).toBe("Text to embed");
|
||||
expect(embeddingObs?.output).toBe("Vector embedding generated");
|
||||
expect(embeddingObs?.usageDetails).toBeDefined();
|
||||
expect(embeddingObs?.costDetails).toBeDefined();
|
||||
}, 20_000);
|
||||
|
||||
it("should filter observations by level parameter", async () => {
|
||||
|
||||
@@ -70,8 +70,8 @@ describe("traces trpc", () => {
|
||||
expect(traceRes?.name).toEqual(trace.name);
|
||||
expect(traceRes?.timestamp).toEqual(new Date(trace.timestamp));
|
||||
expect(traceRes?.tags?.sort()).toEqual(trace.tags?.sort());
|
||||
expect(traceRes?.input).toEqual(trace.input);
|
||||
expect(traceRes?.output).toEqual(trace.output);
|
||||
expect(traceRes?.input).toBeNull();
|
||||
expect(traceRes?.output).toBeNull();
|
||||
expect(traceRes?.userId).toEqual(trace.user_id);
|
||||
expect(traceRes?.sessionId).toEqual(trace.session_id);
|
||||
});
|
||||
|
||||
@@ -30,6 +30,7 @@ import {
|
||||
type PivotTableConfig,
|
||||
type DatabaseRow,
|
||||
type PivotTableRow,
|
||||
getNextSortState,
|
||||
} from "@/src/features/widgets/utils/pivot-table-utils";
|
||||
|
||||
describe("pivot-table-utils", () => {
|
||||
@@ -1014,4 +1015,113 @@ describe("pivot-table-utils", () => {
|
||||
});
|
||||
});
|
||||
});
|
||||
describe("getNextSortState", () => {
|
||||
const defaultSort = { column: "avg_cost", order: "DESC" as const };
|
||||
|
||||
describe("no current sort", () => {
|
||||
test("returns DESC when no current sort", () => {
|
||||
const next = getNextSortState(null, null, "count");
|
||||
expect(next).toEqual({ column: "count", order: "DESC" });
|
||||
});
|
||||
|
||||
test("returns DESC when no current sort with default sort defined", () => {
|
||||
const next = getNextSortState(defaultSort, null, "count");
|
||||
expect(next).toEqual({ column: "count", order: "DESC" });
|
||||
});
|
||||
});
|
||||
|
||||
describe("different column", () => {
|
||||
test("returns DESC when different column", () => {
|
||||
const next = getNextSortState(
|
||||
null,
|
||||
{ column: "metric", order: "ASC" },
|
||||
"count",
|
||||
);
|
||||
expect(next).toEqual({ column: "count", order: "DESC" });
|
||||
});
|
||||
|
||||
test("returns DESC when different column with default sort", () => {
|
||||
const next = getNextSortState(
|
||||
defaultSort,
|
||||
{ column: "metric", order: "ASC" },
|
||||
"count",
|
||||
);
|
||||
expect(next).toEqual({ column: "count", order: "DESC" });
|
||||
});
|
||||
});
|
||||
|
||||
describe("non-default column cycling", () => {
|
||||
test("non-default column: DESC -> ASC", () => {
|
||||
const next = getNextSortState(
|
||||
defaultSort,
|
||||
{ column: "count", order: "DESC" },
|
||||
"count",
|
||||
);
|
||||
expect(next).toEqual({ column: "count", order: "ASC" });
|
||||
});
|
||||
|
||||
test("non-default column: ASC -> default sort", () => {
|
||||
const next = getNextSortState(
|
||||
defaultSort,
|
||||
{ column: "count", order: "ASC" },
|
||||
"count",
|
||||
);
|
||||
expect(next).toEqual(defaultSort);
|
||||
});
|
||||
|
||||
test("non-default column: ASC -> null when no default sort", () => {
|
||||
const next = getNextSortState(
|
||||
null,
|
||||
{ column: "count", order: "ASC" },
|
||||
"count",
|
||||
);
|
||||
expect(next).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
describe("default column cycling", () => {
|
||||
test("default column: DESC -> ASC", () => {
|
||||
const next = getNextSortState(
|
||||
defaultSort,
|
||||
{ column: "avg_cost", order: "DESC" },
|
||||
"avg_cost",
|
||||
);
|
||||
expect(next).toEqual({ column: "avg_cost", order: "ASC" });
|
||||
});
|
||||
|
||||
test("default column: ASC -> DESC (infinite cycle)", () => {
|
||||
const next = getNextSortState(
|
||||
defaultSort,
|
||||
{ column: "avg_cost", order: "ASC" },
|
||||
"avg_cost",
|
||||
);
|
||||
expect(next).toEqual({ column: "avg_cost", order: "DESC" });
|
||||
});
|
||||
});
|
||||
|
||||
describe("edge cases", () => {
|
||||
test("handles undefined default sort", () => {
|
||||
const next = getNextSortState(
|
||||
undefined as any,
|
||||
{ column: "count", order: "ASC" },
|
||||
"count",
|
||||
);
|
||||
expect(next).toBeNull();
|
||||
});
|
||||
|
||||
test("handles null default sort", () => {
|
||||
const next = getNextSortState(
|
||||
null,
|
||||
{ column: "count", order: "ASC" },
|
||||
"count",
|
||||
);
|
||||
expect(next).toBeNull();
|
||||
});
|
||||
|
||||
test("handles null current sort with defined default", () => {
|
||||
const next = getNextSortState(defaultSort, null, "count");
|
||||
expect(next).toEqual({ column: "count", order: "DESC" });
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -3304,5 +3304,48 @@ describe("OTel Resource Span Mapping", () => {
|
||||
expect(traceEvent).toBeDefined();
|
||||
expect(traceEvent.body.sessionId).toBe("session-id-123");
|
||||
});
|
||||
|
||||
it("should default to span-create for unknown observation type", async () => {
|
||||
const otelSpans = [
|
||||
{
|
||||
resource: { attributes: [] },
|
||||
scopeSpans: [
|
||||
{
|
||||
scope: { name: "test-scope" },
|
||||
spans: [
|
||||
{
|
||||
traceId: {
|
||||
data: [
|
||||
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
|
||||
],
|
||||
},
|
||||
spanId: { data: [1, 2, 3, 4, 5, 6, 7, 8] },
|
||||
name: "test-span",
|
||||
startTimeUnixNano: 1000000000,
|
||||
endTimeUnixNano: 2000000000,
|
||||
attributes: [
|
||||
{
|
||||
key: "langfuse.observation.type",
|
||||
value: { stringValue: "invalid_type" },
|
||||
},
|
||||
],
|
||||
status: {},
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
const events = await convertOtelSpanToIngestionEvent(
|
||||
otelSpans[0],
|
||||
new Set(),
|
||||
publicKey,
|
||||
);
|
||||
const spanEvents = events.filter((e) => e.type === "span-create");
|
||||
|
||||
expect(spanEvents.length).toBe(1);
|
||||
expect(spanEvents[0].body.name).toBe("test-span");
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -7,6 +7,7 @@ import {
|
||||
IngestionQueue,
|
||||
logger,
|
||||
QueueName,
|
||||
TraceUpsertQueue,
|
||||
} from "@langfuse/shared/src/server";
|
||||
import { type z } from "zod/v4";
|
||||
|
||||
@@ -101,7 +102,10 @@ export const pruneDatabase = async () => {
|
||||
};
|
||||
export const getQueues = () => {
|
||||
const queues: string[] = Object.values(QueueName);
|
||||
queues.push(...IngestionQueue.getShardNames());
|
||||
queues.push(
|
||||
...IngestionQueue.getShardNames(),
|
||||
...TraceUpsertQueue.getShardNames(),
|
||||
);
|
||||
|
||||
const listOfQueuesToIgnore = [
|
||||
QueueName.DataRetentionQueue,
|
||||
@@ -117,7 +121,14 @@ export const getQueues = () => {
|
||||
.map((queueName) =>
|
||||
queueName.startsWith(QueueName.IngestionQueue)
|
||||
? IngestionQueue.getInstance({ shardName: queueName })
|
||||
: getQueue(queueName as Exclude<QueueName, QueueName.IngestionQueue>),
|
||||
: queueName.startsWith(QueueName.TraceUpsert)
|
||||
? TraceUpsertQueue.getInstance({ shardName: queueName })
|
||||
: getQueue(
|
||||
queueName as Exclude<
|
||||
QueueName,
|
||||
QueueName.IngestionQueue | QueueName.TraceUpsert
|
||||
>,
|
||||
),
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -1,15 +1,18 @@
|
||||
import { env } from "@/src/env.mjs";
|
||||
import { cn } from "@/src/utils/tailwind";
|
||||
import { useSession } from "next-auth/react";
|
||||
import { useState } from "react";
|
||||
|
||||
export const EnvLabel = ({ className }: { className?: string }) => {
|
||||
const [isHidden, setIsHidden] = useState(false);
|
||||
const session = useSession();
|
||||
if (!env.NEXT_PUBLIC_LANGFUSE_CLOUD_REGION) return null;
|
||||
if (!session.data?.user?.email?.endsWith("@langfuse.com")) return null;
|
||||
if (isHidden) return null;
|
||||
return (
|
||||
<div
|
||||
className={cn(
|
||||
"flex items-center gap-1 self-stretch whitespace-nowrap rounded-md px-1 py-0.5 text-xs",
|
||||
"flex cursor-pointer items-center gap-1 self-stretch whitespace-nowrap rounded-md px-1 py-0.5 text-xs",
|
||||
env.NEXT_PUBLIC_LANGFUSE_CLOUD_REGION === "STAGING"
|
||||
? "bg-light-blue text-dark-blue"
|
||||
: env.NEXT_PUBLIC_LANGFUSE_CLOUD_REGION === "DEV"
|
||||
@@ -17,6 +20,7 @@ export const EnvLabel = ({ className }: { className?: string }) => {
|
||||
: "bg-light-red text-dark-red",
|
||||
className,
|
||||
)}
|
||||
onClick={() => setIsHidden(true)}
|
||||
>
|
||||
{["EU", "US", "HIPAA"].includes(env.NEXT_PUBLIC_LANGFUSE_CLOUD_REGION)
|
||||
? `PROD-${env.NEXT_PUBLIC_LANGFUSE_CLOUD_REGION}`
|
||||
|
||||
@@ -14,6 +14,11 @@ import {
|
||||
TestTubeDiagonal,
|
||||
Clock,
|
||||
Bot,
|
||||
Wrench,
|
||||
Link,
|
||||
Search,
|
||||
Layers3,
|
||||
ShieldCheck,
|
||||
} from "lucide-react";
|
||||
import { cva } from "class-variance-authority";
|
||||
import { type ObservationType } from "@langfuse/shared";
|
||||
@@ -38,6 +43,12 @@ const iconMap = {
|
||||
GENERATION: Fan,
|
||||
EVENT: CircleDot,
|
||||
SPAN: MoveHorizontal,
|
||||
AGENT: Bot,
|
||||
TOOL: Wrench,
|
||||
CHAIN: Link,
|
||||
RETRIEVER: Search,
|
||||
EMBEDDING: Layers3,
|
||||
GUARDRAIL: ShieldCheck,
|
||||
SESSION: Clock,
|
||||
USER: User,
|
||||
QUEUE_ITEM: ClipboardPen,
|
||||
@@ -57,6 +68,12 @@ const iconVariants = cva(cn("h-4 w-4"), {
|
||||
GENERATION: "text-muted-magenta",
|
||||
EVENT: "text-muted-green",
|
||||
SPAN: "text-muted-blue",
|
||||
AGENT: "text-purple-600",
|
||||
TOOL: "text-orange-600",
|
||||
CHAIN: "text-indigo-600",
|
||||
RETRIEVER: "text-teal-600",
|
||||
EMBEDDING: "text-amber-600",
|
||||
GUARDRAIL: "text-red-600",
|
||||
SESSION: "text-primary-accent",
|
||||
USER: "text-primary-accent",
|
||||
QUEUE_ITEM: "text-primary-accent",
|
||||
|
||||
@@ -15,19 +15,27 @@ import { CreateLLMApiKeyDialog } from "@/src/features/public-api/components/Crea
|
||||
import useProjectIdFromURL from "@/src/hooks/useProjectIdFromURL";
|
||||
import { cn } from "@/src/utils/tailwind";
|
||||
import {
|
||||
type LLMAdapter,
|
||||
type JSONObject,
|
||||
JSONObjectSchema,
|
||||
LLMAdapter,
|
||||
type supportedModels,
|
||||
type UIModelParams,
|
||||
} from "@langfuse/shared";
|
||||
import { Settings2 } from "lucide-react";
|
||||
import { InfoIcon, Settings2 } from "lucide-react";
|
||||
import {
|
||||
Popover,
|
||||
PopoverContent,
|
||||
PopoverTrigger,
|
||||
} from "@/src/components/ui/popover";
|
||||
import {
|
||||
Tooltip,
|
||||
TooltipContent,
|
||||
TooltipTrigger,
|
||||
} from "@/src/components/ui/tooltip";
|
||||
|
||||
import { LLMApiKeyComponent } from "./LLMApiKeyComponent";
|
||||
import { FormDescription } from "@/src/components/ui/form";
|
||||
import { CodeMirrorEditor } from "../editor";
|
||||
|
||||
export type ModelParamsContext = {
|
||||
modelParams: UIModelParams;
|
||||
@@ -61,6 +69,9 @@ export const ModelParameters: React.FC<ModelParamsContext> = ({
|
||||
const [modelSettingsOpen, setModelSettingsOpen] = useState(false);
|
||||
const [modelSettingsUsed, setModelSettingsUsed] = useState(false);
|
||||
|
||||
const [createLlmApiKeyDialogOpen, setCreateLlmApiKeyDialogOpen] =
|
||||
useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
const hasEnabledModelSetting = Object.keys(modelParams).some(
|
||||
(key) =>
|
||||
@@ -88,11 +99,19 @@ export const ModelParameters: React.FC<ModelParamsContext> = ({
|
||||
</div>
|
||||
)}
|
||||
<p className="text-xs">No LLM API key set in project. </p>
|
||||
<CreateLLMApiKeyDialog />
|
||||
<CreateLLMApiKeyDialog
|
||||
open={createLlmApiKeyDialogOpen}
|
||||
setOpen={setCreateLlmApiKeyDialogOpen}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
const isProviderOptionsSupported = ![
|
||||
LLMAdapter.GoogleAIStudio,
|
||||
LLMAdapter.VertexAI,
|
||||
].includes(modelParams.adapter.value);
|
||||
|
||||
// Settings button component for reuse
|
||||
const SettingsButton = (
|
||||
<Popover open={modelSettingsOpen} onOpenChange={setModelSettingsOpen}>
|
||||
@@ -160,6 +179,15 @@ export const ModelParameters: React.FC<ModelParamsContext> = ({
|
||||
tooltip="An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. We generally recommend altering this or temperature but not both."
|
||||
updateModelParam={updateModelParamValue}
|
||||
/>
|
||||
{isProviderOptionsSupported ? (
|
||||
<ProviderOptionsInput
|
||||
value={modelParams.providerOptions.value}
|
||||
formDisabled={formDisabled}
|
||||
enabled={modelParams.providerOptions.enabled}
|
||||
setModelParamEnabled={setModelParamEnabled}
|
||||
updateModelParam={updateModelParamValue}
|
||||
/>
|
||||
) : null}
|
||||
<LLMApiKeyComponent {...{ projectId, modelParams }} />
|
||||
</div>
|
||||
</PopoverContent>
|
||||
@@ -204,7 +232,10 @@ export const ModelParameters: React.FC<ModelParamsContext> = ({
|
||||
</SelectItem>
|
||||
))}
|
||||
<SelectSeparator />
|
||||
<CreateLLMApiKeyDialog />
|
||||
<CreateLLMApiKeyDialog
|
||||
open={createLlmApiKeyDialogOpen}
|
||||
setOpen={setCreateLlmApiKeyDialogOpen}
|
||||
/>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
{modelParamsDescription ? (
|
||||
@@ -264,21 +295,6 @@ export const ModelParameters: React.FC<ModelParamsContext> = ({
|
||||
layout="vertical"
|
||||
/>
|
||||
</div>
|
||||
|
||||
{modelParams.model.value?.startsWith("o1-") ? (
|
||||
<p className="mt-1 text-xs text-dark-yellow">
|
||||
For {modelParams.model.value}, the system message and the
|
||||
temperature, max_tokens and top_p setting are not supported while it
|
||||
is in beta.{" "}
|
||||
<a
|
||||
href="https://platform.openai.com/docs/guides/reasoning/beta-limitations"
|
||||
target="_blank"
|
||||
rel="noreferrer noopener"
|
||||
>
|
||||
More info ↗
|
||||
</a>
|
||||
</p>
|
||||
) : null}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
@@ -304,6 +320,9 @@ const ModelParamsSelect = ({
|
||||
modelParamsDescription,
|
||||
layout = "vertical",
|
||||
}: ModelParamsSelectProps) => {
|
||||
const [createLlmApiKeyDialogOpen, setCreateLlmApiKeyDialogOpen] =
|
||||
useState(false);
|
||||
|
||||
// Compact layout - simplified, space-efficient (no individual labels)
|
||||
if (layout === "compact") {
|
||||
return (
|
||||
@@ -328,7 +347,10 @@ const ModelParamsSelect = ({
|
||||
</SelectItem>
|
||||
))}
|
||||
<SelectSeparator />
|
||||
<CreateLLMApiKeyDialog />
|
||||
<CreateLLMApiKeyDialog
|
||||
open={createLlmApiKeyDialogOpen}
|
||||
setOpen={setCreateLlmApiKeyDialogOpen}
|
||||
/>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
{modelParamsDescription ? (
|
||||
@@ -374,7 +396,10 @@ const ModelParamsSelect = ({
|
||||
</SelectItem>
|
||||
))}
|
||||
<SelectSeparator />
|
||||
<CreateLLMApiKeyDialog />
|
||||
<CreateLLMApiKeyDialog
|
||||
open={createLlmApiKeyDialogOpen}
|
||||
setOpen={setCreateLlmApiKeyDialogOpen}
|
||||
/>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
{modelParamsDescription ? (
|
||||
@@ -466,3 +491,92 @@ const ModelParamsSlider = ({
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
type ProviderOptionsInputProps = {
|
||||
value: JSONObject | undefined;
|
||||
updateModelParam: ModelParamsContext["updateModelParamValue"];
|
||||
setModelParamEnabled: ModelParamsContext["setModelParamEnabled"];
|
||||
enabled: boolean;
|
||||
formDisabled: boolean;
|
||||
};
|
||||
const ProviderOptionsInput = ({
|
||||
value,
|
||||
updateModelParam,
|
||||
setModelParamEnabled,
|
||||
enabled,
|
||||
formDisabled,
|
||||
}: ProviderOptionsInputProps) => {
|
||||
const [inputValue, setInputValue] = useState<string>(
|
||||
value ? JSON.stringify(value, null, 2) : "{}",
|
||||
);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
|
||||
return (
|
||||
<div
|
||||
className="space-y-3"
|
||||
title="Additional options to pass to the invocation. Please check your provider's API reference for supported values."
|
||||
>
|
||||
<div className="flex flex-row">
|
||||
<div className="flex-1 flex-row space-x-1">
|
||||
<span
|
||||
className={cn(
|
||||
"text-xs font-semibold",
|
||||
(!enabled || formDisabled) && "text-muted-foreground",
|
||||
)}
|
||||
>
|
||||
Additional options
|
||||
</span>
|
||||
<Tooltip>
|
||||
<TooltipTrigger>
|
||||
<InfoIcon className="size-3 text-muted-foreground" />
|
||||
</TooltipTrigger>
|
||||
<TooltipContent className="max-w-[200px] p-2">
|
||||
Additional options to pass to the invocation. Please check your
|
||||
provider's API reference for supported values.
|
||||
</TooltipContent>
|
||||
</Tooltip>
|
||||
</div>
|
||||
<div className="flex flex-row space-x-3">
|
||||
{setModelParamEnabled ? (
|
||||
<Switch
|
||||
title={`Control sending the additional options parameter`}
|
||||
disabled={formDisabled}
|
||||
checked={enabled}
|
||||
onCheckedChange={(checked) => {
|
||||
setModelParamEnabled("providerOptions", checked);
|
||||
}}
|
||||
/>
|
||||
) : null}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{enabled && (
|
||||
<div>
|
||||
<CodeMirrorEditor
|
||||
value={inputValue}
|
||||
onChange={(value) => {
|
||||
setInputValue(value);
|
||||
|
||||
try {
|
||||
const parsed = JSONObjectSchema.parse(JSON.parse(value));
|
||||
updateModelParam("providerOptions", parsed);
|
||||
setError(null);
|
||||
} catch {
|
||||
setError("Invalid JSON Object");
|
||||
}
|
||||
}}
|
||||
editable={enabled && !formDisabled}
|
||||
mode="json"
|
||||
minHeight="none"
|
||||
lineNumbers={false}
|
||||
/>
|
||||
{error && (
|
||||
<span className="pt-6">
|
||||
<p className="text-[12px] text-red-500">{error}</p>
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -70,12 +70,19 @@ const DemoBadge = () => {
|
||||
const router = useRouter();
|
||||
const routerProjectId = router.query.projectId as string | undefined;
|
||||
|
||||
return env.NEXT_PUBLIC_DEMO_ORG_ID &&
|
||||
env.NEXT_PUBLIC_DEMO_PROJECT_ID &&
|
||||
routerProjectId === env.NEXT_PUBLIC_DEMO_PROJECT_ID &&
|
||||
Boolean(env.NEXT_PUBLIC_LANGFUSE_CLOUD_REGION) ? (
|
||||
<div className="flex border-b px-3 py-2">
|
||||
<Alert className="rounded-md bg-light-yellow group-data-[collapsible=icon]:hidden">
|
||||
if (
|
||||
!(
|
||||
env.NEXT_PUBLIC_DEMO_ORG_ID &&
|
||||
env.NEXT_PUBLIC_DEMO_PROJECT_ID &&
|
||||
routerProjectId === env.NEXT_PUBLIC_DEMO_PROJECT_ID &&
|
||||
Boolean(env.NEXT_PUBLIC_LANGFUSE_CLOUD_REGION)
|
||||
)
|
||||
)
|
||||
return null;
|
||||
|
||||
return (
|
||||
<div className="flex border-b px-3 py-2 group-data-[collapsible=icon]:hidden">
|
||||
<Alert className="rounded-md bg-light-yellow">
|
||||
<AlertDescription className="overflow-hidden text-ellipsis whitespace-nowrap text-xs">
|
||||
View-only{" "}
|
||||
<Link
|
||||
@@ -88,5 +95,5 @@ const DemoBadge = () => {
|
||||
</AlertDescription>
|
||||
</Alert>
|
||||
</div>
|
||||
) : null;
|
||||
);
|
||||
};
|
||||
|
||||
@@ -48,7 +48,7 @@ export function EvaluatorsOnboarding({ projectId }: EvaluatorsOnboardingProps) {
|
||||
}}
|
||||
secondaryAction={{
|
||||
label: "Learn More",
|
||||
href: "https://langfuse.com/docs/scores/model-based-evals",
|
||||
href: "https://langfuse.com/docs/evaluation/evaluation-methods/llm-as-a-judge",
|
||||
}}
|
||||
videoSrc="https://static.langfuse.com/prod-assets/onboarding/scores-llm-as-a-judge-overview-v1.mp4"
|
||||
/>
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user