generated from langchain-ai/integration-repo-template
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added Unit standard tests * Updated Unit standard tests * update for unit standard test v2
- Loading branch information
1 parent
086cc32
commit 3501127
Showing
2 changed files
with
36 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
from typing import Type | ||
|
||
from ibm_watsonx_ai import APIClient, Credentials # type: ignore | ||
from ibm_watsonx_ai.service_instance import ServiceInstance # type: ignore | ||
from langchain_core.language_models import BaseChatModel | ||
from langchain_standard_tests.unit_tests import ChatModelUnitTests | ||
|
||
from langchain_ibm import ChatWatsonx | ||
|
||
client = APIClient.__new__(APIClient) | ||
client.CLOUD_PLATFORM_SPACES = True | ||
client.ICP_PLATFORM_SPACES = True | ||
credentials = Credentials(api_key="api_key") | ||
client.credentials = credentials | ||
client.service_instance = ServiceInstance.__new__(ServiceInstance) | ||
client.service_instance._credentials = credentials | ||
|
||
|
||
class TestWatsonxStandard(ChatModelUnitTests): | ||
@property | ||
def chat_model_class(self) -> Type[BaseChatModel]: | ||
return ChatWatsonx | ||
|
||
@property | ||
def chat_model_params(self) -> dict: | ||
return { | ||
"model_id": "ibm/granite-13b-instruct-v2", | ||
"validate_model": False, | ||
"watsonx_client": client, | ||
} |