mirror of
https://github.com/hwchase17/langchain.git
synced 2025-10-09 03:23:39 +00:00
This PR upgrades langchain-community to pydantic 2.
* Most of this PR was auto-generated using code mods with gritql
(https://github.com/eyurtsev/migrate-pydantic/tree/main)
* Subsequently, some code was fixed manually due to accommodate
differences between pydantic 1 and 2
Breaking Changes:
- Use TEXTEMBED_API_KEY and TEXTEMBEB_API_URL for env variables for text
embed integrations:
cbea780492
Other changes:
- Added pydantic_settings as a required dependency for community. This
may be removed if we have enough time to convert the dependency into an
optional one.
---------
Co-authored-by: Eugene Yurtsev <eyurtsev@gmail.com>
Co-authored-by: Bagatur <baskaryan@gmail.com>
20 lines
612 B
Python
20 lines
612 B
Python
from typing import cast
|
|
|
|
from pydantic import SecretStr
|
|
|
|
from langchain_community.embeddings import MiniMaxEmbeddings
|
|
|
|
|
|
def test_initialization_with_alias() -> None:
|
|
"""Test minimax embedding model initialization with alias."""
|
|
api_key = "your-api-key"
|
|
group_id = "your-group-id"
|
|
|
|
embeddings = MiniMaxEmbeddings( # type: ignore[arg-type, call-arg]
|
|
api_key=api_key, # type: ignore[arg-type]
|
|
group_id=group_id, # type: ignore[arg-type]
|
|
)
|
|
|
|
assert cast(SecretStr, embeddings.minimax_api_key).get_secret_value() == api_key
|
|
assert embeddings.minimax_group_id == group_id
|