forked from langchain-ai/langchainjs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds base URL support for Cloudflare WorkersAI (langchain-ai#2970)
* Adds base URL support * Cleanup
- Loading branch information
1 parent
23a2b24
commit 5ce6a78
Showing
7 changed files
with
66 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,19 @@ | ||
import { test } from "@jest/globals"; | ||
import { CloudflareWorkersAI } from "../cloudflare_workersai.js"; | ||
import { getEnvironmentVariable } from "../../util/env.js"; | ||
|
||
test("Test CloudflareWorkersAI", async () => { | ||
const model = new CloudflareWorkersAI({}); | ||
const res = await model.call("1 + 1 ="); | ||
console.log(res); | ||
}, 50000); | ||
|
||
test.skip("Test custom base url", async () => { | ||
const model = new CloudflareWorkersAI({ | ||
baseUrl: `https://gateway.ai.cloudflare.com/v1/${getEnvironmentVariable( | ||
"CLOUDFLARE_ACCOUNT_ID" | ||
)}/lang-chainjs/workers-ai/`, | ||
}); | ||
const res = await model.call("1 + 1 ="); | ||
console.log(res); | ||
}); |