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

Fix Replicate API #5221

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

smontgomerie
Copy link

Fixes #20757 but for LangChainJS

Copy link

vercel bot commented Apr 26, 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 29, 2024 6:27pm
langchainjs-docs ✅ Ready (Inspect) Visit Preview Apr 29, 2024 6:27pm

@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. auto:bug Related to a bug, vulnerability, unexpected error with an existing feature labels Apr 26, 2024
@@ -170,7 +170,7 @@
"prettier": "^2.8.3",
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 the "replicate" dependency was updated from "^0.18.0" to "^0.29.1". This comment is just flagging the change for maintainers to review. Keep up the great work!

@@ -97,15 +97,19 @@ export class Replicate extends LLM implements ReplicateInput {

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 the recent code change in replicate.ts introduces a new external HTTP request using an API client within the if block. I've flagged this for your review to ensure it aligns with the project's design and requirements. Let me know if you have any questions or need further clarification!

@@ -147,7 +168,8 @@ export class Replicate extends LLM implements ReplicateInput {
Replicate: typeof import("replicate").default;
}> {
try {
const { default: Replicate } = await import("replicate");
// eslint-disable-next-line @typescript-eslint/no-var-requires,global-require
const Replicate = require("replicate");
Copy link
Collaborator

Choose a reason for hiding this comment

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

This will cause issue in some environments I think?

We actually don't need dynamic imports anymore, since we've added different entrypoints.

Copy link
Author

Choose a reason for hiding this comment

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

import crashed for me in linux and osx with Jest. Is there a better way to do this?

@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. and removed size:M This PR changes 30-99 lines, ignoring generated files. labels Apr 26, 2024
@jacoblee93
Copy link
Collaborator

jacoblee93 commented Apr 26, 2024

Thanks for this! Ran format and updated imports, but something still seems to be up - the tests all return just "". Think you could have another look?

@smontgomerie
Copy link
Author

Thanks for this! Ran format and updated imports, but something still seems to be up - the tests all return just "". Think you could have another look?

It needs to be run with a REPLICATE_API_TOKEN env var. I assume CI/CD has this?

And also it took two times where it timed out before it started working. I assume this is because Replicate needs to spin up a model on demand? It does work very quickly for me after it spins up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto:bug Related to a bug, vulnerability, unexpected error with an existing feature size:L This PR changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Replicate Version Numbers and issues with running Llama 3 using Langchain's Replicate class
2 participants