Repository navigation
Langsmith tracing #179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Langsmith tracing #179
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
590df89
Enable tracing on LLM agent calls
jmsevin fd25670
Enable tracing on LLM non-agent calls
jmsevin 2d69223
Rebase conflict_1
jmsevin c34a599
Precise names in LangSmith
jmsevin 2f8233b
Precise names for LangSmith tracing
jmsevin 98b8483
Rename Tutor traces
jmsevin 653dc43
Fix linter issue
jmsevin f933804
New TraceContext class
jmsevin 7ab558d
Fix PR comments
jmsevin 206a6c4
Potential fix for pull request finding
jmsevin 97ebd32
Suggestion by Copilot
jmsevin 9804dd7
Potential fix for pull request finding
jmsevin 401976f
Add routing tests
jmsevin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| import os | ||
|
|
||
| from src.app.core.config import Settings | ||
| from src.app.utils.logger import logger as utils_logger | ||
|
|
||
| logger = utils_logger(__name__) | ||
|
|
||
|
|
||
| def configure_langsmith_tracing(settings: Settings) -> None: | ||
| """Configure LangSmith tracing for LangChain-based model calls.""" | ||
|
|
||
| is_enabled = settings.LANGSMITH_TRACING_ENABLED | ||
|
|
||
| os.environ["LANGSMITH_TRACING"] = "true" if is_enabled else "false" | ||
|
|
||
| if not is_enabled: | ||
| logger.info("langsmith_tracing_enabled=false") | ||
| return | ||
|
|
||
| if settings.LANGSMITH_PROJECT: | ||
| os.environ["LANGCHAIN_PROJECT"] = settings.LANGSMITH_PROJECT | ||
| else: | ||
| logger.warning( | ||
| "langsmith_tracing_enabled=true but LANGSMITH_PROJECT is missing" | ||
| ) | ||
|
|
||
| if settings.LANGSMITH_ENDPOINT: | ||
| os.environ["LANGCHAIN_ENDPOINT"] = settings.LANGSMITH_ENDPOINT | ||
| else: | ||
| logger.warning( | ||
| "langsmith_tracing_enabled=true but LANGSMITH_ENDPOINT is missing" | ||
| ) | ||
|
|
||
| if settings.LANGSMITH_API_KEY: | ||
| os.environ["LANGSMITH_API_KEY"] = settings.LANGSMITH_API_KEY | ||
| else: | ||
| logger.warning( | ||
| "langsmith_tracing_enabled=true but LANGSMITH_API_KEY is missing" | ||
| ) | ||
|
|
||
| logger.info( | ||
| "langsmith_tracing_enabled=true project=%s endpoint=%s", | ||
| settings.LANGSMITH_PROJECT, | ||
| settings.LANGSMITH_ENDPOINT, | ||
| ) |
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.