-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
feat: add arcjet redact integration #6674
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Skipped Deployment
|
@e-moran is attempting to deploy a commit to the LangChain Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this!
Looks solid overall - only thing is that most people use chat models rather than text-in/text-out LLMs these days (gpt-4, 3.5-sonnet, mistral-large are all chat models).
I can merge this more or less as is but it might be better to make this a chat model wrapper instead?
@@ -0,0 +1,34 @@ | |||
import CodeBlock from "@theme/CodeBlock"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We prefer standardization along the lines of this template:
Happy to update it though after other comments are addressed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've migrated this to jupyter
import { OpenAI } from "@langchain/openai"; | ||
|
||
// Create an instance of another LLM for Arcjet to wrap | ||
const openai = new OpenAI({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We probably will want this to work with chat models - most state of the art models are chat models rather than LLMs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are planning on adding a second integration for chat models, I'm planning on adding that in a second PR though since it is a separate piece of work but I'm happy to add it to this PR if you think that would be better.
constructor(options: ArcjetRedactOptions<Detect>) { | ||
super(options); | ||
|
||
if (!options.llm) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we rely on TypeScript for some of these?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I've removed all of the ones that aren't handled by TS
…hainjs into eoin/add-arcjet-integration
@@ -91,6 +91,7 @@ export const config = { | |||
// llms | |||
"llms/ai21": "llms/ai21", | |||
"llms/aleph_alpha": "llms/aleph_alpha", | |||
"llms/arcjet": "llms/arcjet", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will need to add these under requiresOptionalDependency
below but I can do that
@@ -163,6 +164,7 @@ export const config = { | |||
"vectorstores/zep_cloud": "vectorstores/zep_cloud", | |||
// chat_models | |||
"chat_models/alibaba_tongyi": "chat_models/alibaba_tongyi", | |||
"chat_models/arcjet": "chat_models/arcjet", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same see above
@@ -213,6 +213,7 @@ | |||
"youtubei.js": "^9.1.0" | |||
}, | |||
"peerDependencies": { | |||
"@arcjet/redact": "^v1.0.0-alpha.23", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be more relaxed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also needs to be under devDependencies
too but I can add that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No that's actually the first version of the package. While we're in alpha we're just using common versioning for all of our npm packages, so @arcjet/redact
starts with v1.0.0-alpha.32
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It starts with v1.0.0-alpha.23
not v1.0.0-alpha.32`.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, small question on deps but I can fix it up and merge this weekend.
Thanks for your patience!
Anything else you need from us to get this over the line @jacoblee93 ? We're aiming to announce the redaction features on Thursday 💪 |
Reviewing now! |
Hey @davidmytton I couldn't push to this branch but created #6725 with build and CJS fixes. Also removed the Let me know what you think! Will merge later. |
Looks good - thanks for the edits! |
Merged there, closing this! |
This PR introduces the Arcjet Redact langchainjs integration, it provides local sensitive information redaction and un-redaction capabilities using the @arcjet/redact package. Data that is redacted using Arcjet never leaves your machine, ensuring best in class performance and privacy.