Add PostHog LLM analytics with tags, session_ids, and host_ids#28
Open
Add PostHog LLM analytics with tags, session_ids, and host_ids#28
Conversation
- Add tag parameter to LLM.chat() method signature - Tag all LLM calls to identify their use case: - chat: participant chat interactions - monica_ai: Monica AI multi-session queries - monica_ai_rag: Monica AI single-session RAG queries - summary_generation: session summary generation - session_completion_check: checking if session is complete - session_user_response: simulated user responses - builder_create_prompt, builder_edit_prompt, builder_summary_prompt - cross_pollination_analysis, cross_pollination_question - data_export, file_analysis, query_type_analysis - simulated_participant, form_answer_generation, character_generation - Resolve merge conflict in modelConfig.ts 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Enables cost attribution per session and host by adding session_ids and host_ids arrays to $ai_generation events. - session_ids: The host_sessions.id identifying the workshop - host_ids: The owner's user_id from permissions table (Auth0 sub) Changes: - Add sessionIds/hostIds params to LLM.chat() interface - Create getSessionOwner() and getSessionOwners() helpers in db.ts - Update all LLM call sites to pass session/host context: - llamaUtils.ts (chat handler) - sessionGenerator.ts - characterGenerator.ts - crossPollinationManager.ts - monicaMultiSession.ts - monicaSingleSessionRAG.ts - summaryMultiSession.ts 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Collaborator
Author
|
Note on package-lock.json: This PR includes ~870 lines of deletions in package-lock.json. These are optional peer dependencies (sharp image processing binaries, @emnapi/runtime, etc.) that got removed when npm resolved the lock file on my machine. Likely due to different npm version or platform. These are platform-specific optional packages that get installed as-needed. It shouldn't affect functionality, but if you'd prefer to keep the lock file unchanged, I can revert just that file from the PR. |
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
'cross_pollination_question')
Changes
Analytics enhancement:
Files updated:
Test plan
EDIT: Note on package-lock.json:
This PR includes ~870 lines of deletions in package-lock.json. These are optional peer dependencies (sharp image processing binaries, @emnapi/runtime, etc.) that got removed when npm resolved the lock file on my machine. Likely due to different npm version or platform.
These are platform-specific optional packages that get installed as-needed. It shouldn't affect functionality, but if you'd prefer to keep the lock file unchanged, I can revert just that file from the PR.