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.
ci[minor]: Run fireworks and gvertex in daily standard tests (langcha…
…in-ai#6507) * ci[minor]: Run fireworks and gvertex in daily standard tests * update gvertex standard test secrets parsing * cr * undo yarn install command * add standard tests to web * update tests * revert non web test changes * update secret name in gh action * skip aws retriever tests * dynamic env injection * dynamic env injection
- Loading branch information
1 parent
7482d6c
commit d51102d
Showing
9 changed files
with
146 additions
and
168 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
61 changes: 61 additions & 0 deletions
61
libs/langchain-google-vertexai-web/src/tests/chat_models.standard.int.test.ts
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 |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/* eslint-disable no-process-env */ | ||
import { test, expect } from "@jest/globals"; | ||
import { ChatModelIntegrationTests } from "@langchain/standard-tests"; | ||
import { AIMessageChunk } from "@langchain/core/messages"; | ||
import { GoogleAIBaseLanguageModelCallOptions } from "@langchain/google-common"; | ||
import { ChatVertexAI } from "../chat_models.js"; | ||
|
||
class ChatVertexAIStandardIntegrationTests extends ChatModelIntegrationTests< | ||
GoogleAIBaseLanguageModelCallOptions, | ||
AIMessageChunk | ||
> { | ||
constructor() { | ||
if (!process.env.GOOGLE_VERTEX_AI_WEB_CREDENTIALS) { | ||
throw new Error("Missing secrets for Google VertexAI standard tests."); | ||
} | ||
|
||
super({ | ||
Cls: ChatVertexAI, | ||
chatModelHasToolCalling: true, | ||
chatModelHasStructuredOutput: true, | ||
supportsParallelToolCalls: true, | ||
invokeResponseType: AIMessageChunk, | ||
constructorArgs: { | ||
model: "gemini-1.5-pro", | ||
authOptions: { | ||
credentials: JSON.parse(process.env.GOOGLE_VERTEX_AI_WEB_CREDENTIALS), | ||
}, | ||
}, | ||
}); | ||
} | ||
|
||
async testToolMessageHistoriesListContent() { | ||
this.skipTestMessage( | ||
"testToolMessageHistoriesListContent", | ||
"ChatVertexAI", | ||
"Not implemented." | ||
); | ||
} | ||
|
||
async testInvokeMoreComplexTools() { | ||
this.skipTestMessage( | ||
"testInvokeMoreComplexTools", | ||
"ChatVertexAI", | ||
"Google VertexAI does not support tool schemas which contain object with unknown/any parameters." + | ||
"Google VertexAI only supports objects in schemas when the parameters are defined." | ||
); | ||
} | ||
|
||
async testParallelToolCalling() { | ||
// Pass `true` in the second argument to only verify it can support parallel tool calls in the message history. | ||
// This is because the model struggles to actually call parallel tools. | ||
await super.testParallelToolCalling(undefined, true); | ||
} | ||
} | ||
|
||
const testClass = new ChatVertexAIStandardIntegrationTests(); | ||
|
||
test("ChatVertexAIStandardIntegrationTests", async () => { | ||
const testResults = await testClass.runTests(); | ||
expect(testResults).toBe(true); | ||
}); |
39 changes: 39 additions & 0 deletions
39
libs/langchain-google-vertexai-web/src/tests/chat_models.standard.test.ts
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 |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* eslint-disable no-process-env */ | ||
import { test, expect } from "@jest/globals"; | ||
import { ChatModelUnitTests } from "@langchain/standard-tests"; | ||
import { AIMessageChunk } from "@langchain/core/messages"; | ||
import { GoogleAIBaseLanguageModelCallOptions } from "@langchain/google-common"; | ||
import { ChatVertexAI } from "../chat_models.js"; | ||
|
||
class ChatVertexAIStandardUnitTests extends ChatModelUnitTests< | ||
GoogleAIBaseLanguageModelCallOptions, | ||
AIMessageChunk | ||
> { | ||
constructor() { | ||
super({ | ||
Cls: ChatVertexAI, | ||
chatModelHasToolCalling: true, | ||
chatModelHasStructuredOutput: true, | ||
constructorArgs: {}, | ||
}); | ||
// This must be set so method like `.bindTools` or `.withStructuredOutput` | ||
// which we call after instantiating the model will work. | ||
// (constructor will throw if API key is not set) | ||
process.env.GOOGLE_VERTEX_AI_WEB_CREDENTIALS = "test"; | ||
} | ||
|
||
testChatModelInitApiKey() { | ||
this.skipTestMessage( | ||
"testChatModelInitApiKey", | ||
"ChatVertexAI (webauth)", | ||
this.multipleApiKeysRequiredMessage | ||
); | ||
} | ||
} | ||
|
||
const testClass = new ChatVertexAIStandardUnitTests(); | ||
|
||
test("ChatVertexAIStandardUnitTests", () => { | ||
const testResults = testClass.runTests(); | ||
expect(testResults).toBe(true); | ||
}); |
Oops, something went wrong.