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

cloudflare[minor]: Add tool calling support #5820

Draft
wants to merge 16 commits into
base: main
Choose a base branch
from

Conversation

bracesproul
Copy link
Collaborator

todo: docs

Copy link

vercel bot commented Jun 20, 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 Jul 15, 2024 11:46pm
langchainjs-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 15, 2024 11:46pm

@bracesproul bracesproul marked this pull request as ready for review June 20, 2024 18:48
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. auto:documentation Changes to documentation and examples, like .md, .rst, .ipynb files. Changes to the docs/ folder auto:improvement Medium size change to existing code to handle new use-cases labels Jun 20, 2024
@@ -0,0 +1,101 @@
import { ChatCloudflareWorkersAI } from "@langchain/cloudflare";
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 recent changes explicitly access environment variables using process.env. I've flagged this for your review to ensure that the handling of environment variables aligns with best practices. Let me know if you have any questions or need further assistance!

@@ -37,7 +37,8 @@
"dependencies": {
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 a new dependency "zod-to-json-schema" has been added and the existing "uuid" dependency has been updated in the "dependencies" section. This is flagged for your review to ensure it aligns with the project's dependency management strategy. Keep up the great work!

@@ -146,10 +249,10 @@ export class ChatCloudflareWorkersAI
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 adds a new external HTTP request using the fetch function. 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!

@@ -3,25 +3,109 @@ import {
SimpleChatModel,
Copy link

Choose a reason for hiding this comment

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

Hey team, I've reviewed the code and noticed that the recent changes in the PR are accessing the getEnvironmentVariable function to retrieve an environment variable. This comment is to flag this change for your review. Let me know if you need further assistance with this.

@@ -1,4 +1,4 @@
import { Ai } from "@cloudflare/ai";
import { Ai } from "@cloudflare/ai/dist/ai.js";
Copy link
Collaborator

Choose a reason for hiding this comment

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

Por que?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I was unable to run in examples, or in a local project due to this error:

file:///Users/bracesproul/code/lang-chain-ai/wt/brace/cloudflare-tools/libs/langchain-cloudflare/dist/embeddings.js:2
import { Ai } from "@cloudflare/ai";
         ^^
SyntaxError: The requested module '@cloudflare/ai' does not provide an export named 'Ai'

When I switched the import path the error went away.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

awe shit, in triggering this error again to show you, it's now persisting even with that new path. Will try and fix

Choose a reason for hiding this comment

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

That package is on the way out!

There is a TypeScript SDK now that wraps nicely...but also it's on the Binding env.AI.run not sure how to do this.

Copy link

Choose a reason for hiding this comment

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

I have a PR up that uses the native binding: #5287

@bracesproul bracesproul marked this pull request as draft June 20, 2024 22:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto:documentation Changes to documentation and examples, like .md, .rst, .ipynb files. Changes to the docs/ folder auto:improvement Medium size change to existing code to handle new use-cases size:L This PR changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants