🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.
TypeScript analyticsautogenevaluationlangchainlarge-language-modelsllama-indexllmllm-evaluationllm-observabilityllmopsmonitoringobservabilityopen-sourceopenaiplaygroundprompt-engineeringprompt-managementself-hostedycombinator
feat(playground): allow uppercase in tool / schema names (#6326)
Hassieb Pakzadc014612cca34
diff --git a/web/src/ee/features/playground/page/components/CreateOrEditLLMSchemaDialog.tsx b/web/src/ee/features/playground/page/components/CreateOrEditLLMSchemaDialog.tsxindex 684459d279..98d362b753 100644--- a/web/src/ee/features/playground/page/components/CreateOrEditLLMSchemaDialog.tsx+++ b/web/src/ee/features/playground/page/components/CreateOrEditLLMSchemaDialog.tsx@@ -1,6 +1,7 @@import React, { useEffect, useState } from "react";import { useForm } from "react-hook-form";import { zodResolver } from "@hookform/resolvers/zod";+import { ArrowUpRight } from "lucide-react";import * as z from "zod";import { Button } from "@/src/components/ui/button";@@ -24,20 +25,14 @@ import {} from "@/src/components/ui/form";import { Input } from "@/src/components/ui/input";import { Textarea } from "@/src/components/ui/textarea";+import { LLMSchemaNameSchema } from "@/src/features/llm-schemas/validation";import { api } from "@/src/utils/api";import { JSONSchemaFormSchema, type LlmSchema } from "@langfuse/shared";import { CodeMirrorEditor } from "@/src/components/editor";-import { ArrowUpRight } from "lucide-react";const formSchema = z.object({- name: z- .string()- .regex(- /^[a-z0-9_-]+$/,- "Name must contain only lowercase letters, numbers, hyphens and underscores",- )- .min(1, "Name is required"),+ name: LLMSchemaNameSchema,description: z.string().min(1, "Description is required"),schema: JSONSchemaFormSchema,});diff --git a/web/src/ee/features/playground/page/components/CreateOrEditLLMToolDialog.tsx b/web/src/ee/features/playground/page/components/CreateOrEditLLMToolDialog.tsxindex 3ebda40fbb..f5f5c69e7b 100644--- a/web/src/ee/features/playground/page/components/CreateOrEditLLMToolDialog.tsx+++ b/web/src/ee/features/playground/page/components/CreateOrEditLLMToolDialog.tsx@@ -1,6 +1,7 @@import React, { useEffect, useState } from "react";import { useForm } from "react-hook-form";import { zodResolver } from "@hookform/resolvers/zod";+import { ArrowUpRight } from "lucide-react";import * as z from "zod";import { Button } from "@/src/components/ui/button";@@ -24,20 +25,14 @@ import {} from "@/src/components/ui/form";import { Input } from "@/src/components/ui/input";import { Textarea } from "@/src/components/ui/textarea";+import { LLMToolNameSchema } from "@/src/features/llm-tools/validation";import { api } from "@/src/utils/api";import { CodeMirrorEditor } from "@/src/components/editor";import { JSONSchemaFormSchema, type LlmTool } from "@langfuse/shared";-import { ArrowUpRight } from "lucide-react";const formSchema = z.object({- name: z- .string()- .regex(- /^[a-z0-9_-]+$/,- "Name must contain only lowercase letters, numbers, hyphens and underscores",- )- .min(1, "Name is required"),+ name: LLMToolNameSchema,description: z.string().min(1, "Description is required"),parameters: JSONSchemaFormSchema,});diff --git a/web/src/features/llm-schemas/validation.ts b/web/src/features/llm-schemas/validation.tsindex 6326d647e2..602301a9a1 100644--- a/web/src/features/llm-schemas/validation.ts+++ b/web/src/features/llm-schemas/validation.ts@@ -1,14 +1,16 @@import { z } from "zod";import { LLMJSONSchema } from "@langfuse/shared";+export const LLMSchemaNameSchema = z+ .string()+ .regex(+ /^[a-zA-Z0-9_-]+$/,+ "Name must contain only alphanumeric letters, hyphens and underscores",+ )+ .min(1, "Name is required");+export const LLMSchemaInput = z.object({- name: z- .string()- .regex(- /^[a-z0-9_-]+$/,- "Name must contain only lowercase letters, numbers, hyphens and underscores",- )- .min(1, "Name is required"),+ name: LLMSchemaNameSchema,description: z.string(),schema: LLMJSONSchema,});diff --git a/web/src/features/llm-tools/validation.ts b/web/src/features/llm-tools/validation.tsindex 1e59135378..bf34aad179 100644--- a/web/src/features/llm-tools/validation.ts+++ b/web/src/features/llm-tools/validation.ts@@ -1,14 +1,16 @@import { z } from "zod";import { LLMJSONSchema } from "@langfuse/shared";+export const LLMToolNameSchema = z+ .string()+ .regex(+ /^[a-zA-Z0-9_-]+$/,+ "Name must contain only alphanumeric letters, hyphens and underscores",+ )+ .min(1, "Name is required");+export const LLMToolInput = z.object({- name: z- .string()- .regex(- /^[a-z0-9_-]+$/,- "Name must contain only lowercase letters, numbers, hyphens and underscores",- )- .min(1, "Name is required"),+ name: LLMToolNameSchema,description: z.string(),parameters: LLMJSONSchema,});