Add LangSmith Cloud observability for all AI API calls#11
Open
pyrex41 wants to merge 1 commit into
Open
Conversation
Add comprehensive tracing for production monitoring and debugging: - OpenAI (GPT-4o, GPT-4o-mini) - scene generation, semantic augmentation - Anthropic (Claude) - prompt parsing, creative direction - XAI (Grok-4) - AI-powered image pair selection - Replicate API - image/video/audio generation (Flux, SkyReels, Veo3, Hailuo) - HTTP requests - FastAPI middleware for end-to-end tracing Changes: - Add langsmith, langchain-openai, langchain-anthropic dependencies - Instrument all LLM provider methods with @Traceable decorators - Add LangSmithMiddleware to both backend and promptparser FastAPI apps - Configure environment variables in config files and docker-compose.yml - Create comprehensive setup documentation (LANGSMITH_SETUP.md) Benefits: - Real-time observability of all AI API calls in LangSmith dashboard - Track costs, latency, errors, and token usage per model - Hierarchical traces showing full request → LLM call flow - Easy debugging with prompt/response inspection - Filter and search by tags (openai, anthropic, xai, grok, replicate) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
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
Add comprehensive LangSmith Cloud observability for monitoring and debugging all AI API calls in production.
What's Traced
Key Features
openai,anthropic,xai,grok,replicate,http_requestImplementation
Dependencies Added
langsmith- Core tracing SDKlangchain-openai- OpenAI integrationlangchain-anthropic- Anthropic integrationCode Changes (14 files, 364 additions)
@traceabledecorators to all LLM provider methodsLangSmithMiddlewarefor both FastAPI appsDocumentation
LANGSMITH_SETUP.mdwith complete setup guideFiles Changed
LANGSMITH_SETUP.md- Complete setup documentationpyproject.toml- Dependenciesbackend/config.py- LangSmith settingsbackend/main.py- HTTP request middlewarebackend/llm_interpreter.py- OpenAI tracingbackend/services/scene_generator.py- OpenAI tracingbackend/services/xai_client.py- XAI/Grok tracingbackend/services/replicate_client.py- Replicate tracingpromptparser/.env.example- Example env varspromptparser/app/core/config.py- LangSmith settingspromptparser/app/main.py- HTTP request middlewarepromptparser/app/services/llm/openai_provider.py- OpenAI tracingpromptparser/app/services/llm/claude_provider.py- Anthropic tracingdocker-compose.yml- Environment variablesSetup
.env:uv pip install -e .Notes
LANGCHAIN_TRACING_V2=false)🤖 Generated with Claude Code