Skip to content
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

[Security Assistant] Fixes LangSmith support for specifying configuration via env vars #180426

Merged
merged 2 commits into from
Apr 10, 2024

Conversation

spong
Copy link
Member

@spong spong commented Apr 9, 2024

Summary

With #180227, LangSmith configuration (Project & API Key) could no longer be specified using environment variables when working locally. This fixes that issue, which was caused by sending '' for langSmithProject and langSmithApiKey instead of undefined.

To test, set the below env vars, then start kibana. Be sure to not have the UI trace options set as shown in #180227.

# LangChain LangSmith
export LANGCHAIN_TRACING_V2=true
export LANGCHAIN_ENDPOINT="https://api.smith.langchain.com"
export LANGCHAIN_API_KEY="🫣"
export LANGCHAIN_PROJECT="Best Project Ever"

@spong spong added bug Fixes for quality problems that affect the customer experience release_note:skip Skip the PR/issue when compiling release notes Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. Feature:Security Assistant Security Assistant Team:Security Generative AI Security Generative AI v8.14.0 labels Apr 9, 2024
@spong spong requested a review from stephmilovic April 9, 2024 23:12
@spong spong self-assigned this Apr 9, 2024
@spong spong requested a review from a team as a code owner April 9, 2024 23:12
@elasticmachine
Copy link
Contributor

Pinging @elastic/security-solution (Team: SecuritySolution)

@@ -124,7 +124,7 @@ export const getLangSmithTracer = ({
return [];
}
const lcTracer = new LangChainTracer({
projectName: projectName ?? 'default', // Shows as the 'test' run's 'name' in langsmith ui
projectName, // Shows as the 'test' run's 'name' in langsmith ui
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's fine to pass in undefined as the projectName here. LangChain will attempt to fetch it from the env vars, and if still not available it will then fall back to default when pushing to LangSmith.

Copy link
Contributor

@stephmilovic stephmilovic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for getting this fixed quickly. Ran your test and had success, LGTM!

@spong spong enabled auto-merge (squash) April 9, 2024 23:21
@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
securitySolution 17.0MB 17.0MB +83.0B

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @spong

@spong spong merged commit e7401d3 into elastic:main Apr 10, 2024
46 checks passed
@kibanamachine kibanamachine added the backport:skip This commit does not require backporting label Apr 10, 2024
@spong spong deleted the langsmith-env-fix branch April 10, 2024 02:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting bug Fixes for quality problems that affect the customer experience Feature:Security Assistant Security Assistant release_note:skip Skip the PR/issue when compiling release notes Team:Security Generative AI Security Generative AI Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. v8.14.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants