feat: let prepare-demo point LibreChat at a remote Langfuse#16
Merged
Conversation
LibreChat's Langfuse instrumentation was hardcoded in librechat-compose.yml to the local langfuse-web container with the auto-generated INIT_PROJECT keys, which made it impossible to send traces to Langfuse Cloud (or any remote Langfuse) without hand-editing the compose file. This change splits the LibreChat-side Langfuse config into three dedicated env vars (LANGFUSE_PUBLIC_KEY, LANGFUSE_SECRET_KEY, LANGFUSE_BASE_URL), defaulted by generate-env.sh to the local stack, and adds an interactive step to prepare-demo.sh that asks the user whether to keep traces local or point at a remote Langfuse project (prompting for base URL, public key, and secret key in that case). A small backfill block in prepare-demo.sh seeds defaults from LANGFUSE_INIT_PROJECT_* on older .env files so the new compose template keeps working untouched after pulling this branch.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
librechat-compose.ymlinto three dedicated env vars (LANGFUSE_PUBLIC_KEY,LANGFUSE_SECRET_KEY,LANGFUSE_BASE_URL) instead of hardcodinghttp://langfuse-web:3000and the auto-generatedLANGFUSE_INIT_PROJECT_*keys.scripts/generate-env.shnow writes those three keys defaulted to the local Langfuse stack, so the default./scripts/prepare-demo.shflow is unchanged.scripts/prepare-demo.shgains an interactive step after the provider-key menu: it asks whether to keep traces local or point at a remote Langfuse project, and when "cloud" is selected prompts for base URL (defaulthttps://cloud.langfuse.com), public key, and secret key, then writes them to.envvia a newset_env_varupsert helper.prepare-demo.shso older.envfiles (generated before this change) keep working: ifLANGFUSE_BASE_URL/LANGFUSE_PUBLIC_KEY/LANGFUSE_SECRET_KEYare missing, they get seeded from the existingLANGFUSE_INIT_PROJECT_*values and the local Langfuse URL..env.exampleand the README's Quick Start section mention the new option.Test plan
./scripts/prepare-demo.shthen answern(or hit enter) at the Langfuse prompt; confirm.envkeepsLANGFUSE_BASE_URL=http://langfuse-web:3000and the auto-generatedpk-lf-…/sk-lf-…keys../scripts/prepare-demo.shthen answery, enter a real Langfuse Cloud base URL + project keys; confirm.envis updated anddocker compose up -dmakes LibreChat send traces to that project..env: re-runprepare-demo.sh; confirm the three new keys get backfilled fromLANGFUSE_INIT_PROJECT_*and the local Langfuse stack still receives traces.