-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
community[minor]: Add standard tests to community chat models
- Loading branch information
1 parent
e66d30e
commit 8d8fac1
Showing
5 changed files
with
98 additions
and
13 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
39 changes: 39 additions & 0 deletions
39
libs/langchain-community/src/chat_models/tests/chatbedrock.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 { BedrockChat } from "../bedrock/index.js"; | ||
import { BaseChatModelCallOptions } from "@langchain/core/language_models/chat_models"; | ||
|
||
class BedrockChatStandardUnitTests extends ChatModelUnitTests< | ||
BaseChatModelCallOptions, | ||
AIMessageChunk | ||
> { | ||
constructor() { | ||
super({ | ||
Cls: BedrockChat, | ||
chatModelHasToolCalling: false, | ||
chatModelHasStructuredOutput: false, | ||
constructorArgs: {}, | ||
}); | ||
process.env.BEDROCK_AWS_SECRET_ACCESS_KEY = "test"; | ||
process.env.BEDROCK_AWS_ACCESS_KEY_ID = "test"; | ||
process.env.BEDROCK_AWS_SESSION_TOKEN = "test"; | ||
process.env.AWS_DEFAULT_REGION = "us-east-1"; | ||
} | ||
|
||
testChatModelInitApiKey() { | ||
this.skipTestMessage( | ||
"testChatModelInitApiKey", | ||
"BedrockChat", | ||
this.multipleApiKeysRequiredMessage | ||
) | ||
} | ||
} | ||
|
||
const testClass = new BedrockChatStandardUnitTests(); | ||
|
||
test("BedrockChatStandardUnitTests", () => { | ||
const testResults = testClass.runTests(); | ||
expect(testResults).toBe(true); | ||
}); |
36 changes: 36 additions & 0 deletions
36
libs/langchain-community/src/chat_models/tests/chatfireworks.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,36 @@ | ||
/* eslint-disable no-process-env */ | ||
import { test, expect } from "@jest/globals"; | ||
import { ChatModelUnitTests } from "@langchain/standard-tests"; | ||
import { AIMessageChunk } from "@langchain/core/messages"; | ||
import { ChatFireworks, ChatFireworksCallOptions } from "../fireworks.js"; | ||
|
||
class ChatFireworksStandardUnitTests extends ChatModelUnitTests< | ||
ChatFireworksCallOptions, | ||
AIMessageChunk | ||
> { | ||
constructor() { | ||
super({ | ||
Cls: ChatFireworks, | ||
chatModelHasToolCalling: true, | ||
chatModelHasStructuredOutput: true, | ||
constructorArgs: {}, | ||
}); | ||
process.env.FIREWORKS_API_KEY = "test"; | ||
} | ||
|
||
testChatModelInitApiKey() { | ||
// Unset the API key env var here so this test can properly check | ||
// the API key class arg. | ||
process.env.FIREWORKS_API_KEY = ""; | ||
super.testChatModelInitApiKey(); | ||
// Re-set the API key env var here so other tests can run properly. | ||
process.env.FIREWORKS_API_KEY = "test"; | ||
} | ||
} | ||
|
||
const testClass = new ChatFireworksStandardUnitTests(); | ||
|
||
test("ChatFireworksStandardUnitTests", () => { | ||
const testResults = testClass.runTests(); | ||
expect(testResults).toBe(true); | ||
}); |
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