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

Brace/anthropic tools #4978

Merged
merged 9 commits into from
Apr 4, 2024
Merged

Brace/anthropic tools #4978

merged 9 commits into from
Apr 4, 2024

Conversation

bracesproul
Copy link
Collaborator

No description provided.

Copy link

vercel bot commented Apr 4, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
langchainjs-api-refs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 4, 2024 8:58pm
langchainjs-docs ✅ Ready (Inspect) Visit Preview Apr 4, 2024 8:58pm

@bracesproul bracesproul marked this pull request as ready for review April 4, 2024 20:28
@dosubot dosubot bot added size:XXL This PR changes 1000+ lines, ignoring generated files. auto:enhancement A large net-new component, integration, or chain. Use sparingly. The largest features labels Apr 4, 2024
@@ -0,0 +1,100 @@
import { ChatAnthropic } from "@langchain/anthropic";
Copy link

Choose a reason for hiding this comment

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

Hey there! 👋 I've flagged this PR for your review because it adds code that explicitly accesses an environment variable using process.env. Please take a look and ensure that the handling of environment variables aligns with best practices. Let me know if you need any further assistance with this!

@@ -0,0 +1,64 @@
import { ChatAnthropic } from "@langchain/anthropic";
Copy link

Choose a reason for hiding this comment

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

Hey there! I've reviewed the code and noticed that the added code explicitly accesses an environment variable via process.env. I've flagged this for your review to ensure it aligns with security best practices. Let me know if you need further assistance with this.

@@ -0,0 +1,90 @@
import { ChatAnthropic } from "@langchain/anthropic";
Copy link

Choose a reason for hiding this comment

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

Hey team, just a heads up that I've flagged the latest change in the PR for review. It explicitly accesses the ANTHROPIC_API_KEY environment variable using process.env, so it's important to ensure that this is handled securely. Keep up the great work!

@@ -401,11 +615,7 @@ export class ChatAnthropicMessages<
const params = this.invocationParams(options);
Copy link

Choose a reason for hiding this comment

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

Hey there! I noticed that this PR introduces a new external HTTP request using fetch or axios. I've flagged this change for your review to ensure it aligns with the project's requirements. Let me know if you have any questions or need further clarification!

const headers = tools ? toolUseBetaHeader : undefined;
return {
signal: options.signal,
...(body ? { body } : {}),
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is confusing but I guess we'll delete it soon anyway

return {
signal: options.signal,
...(body ? { body } : {}),
...(headers ? { headers } : {}),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same

const requestOptions = this.invocationOptions(
{
...params,
stream: false,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why reverse the order?

): Promise<Stream<AnthropicMessageStreamEvent>> {
if (!this.streamingClient) {
const options = this.apiUrl ? { baseURL: this.apiUrl } : undefined;
const options_ = this.apiUrl ? { baseURL: this.apiUrl } : undefined;
Copy link
Collaborator

@jacoblee93 jacoblee93 Apr 4, 2024

Choose a reason for hiding this comment

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

For the future: I despise this pattern. Just call requestOptions or something

return this.caller.callWithOptions(
{ signal: options.signal },
{ signal: options.signal ?? undefined },
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

signal in caller has to be signal or undefined, their sdk types it as signal, null or undefined and I'm using their types for this.

const name = config?.name;
const method = config?.method;
const includeRaw = config?.includeRaw;
if (method === "jsonMode") {
Copy link
Collaborator

Choose a reason for hiding this comment

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

We should make this type just string at some point

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto:enhancement A large net-new component, integration, or chain. Use sparingly. The largest features size:XXL This PR changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants