mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-18 08:03:36 +00:00
community[patch]: upgrade to recent version of mypy (#21616)
This PR upgrades community to a recent version of mypy. It inserts type: ignore on all existing failures.
This commit is contained in:
@@ -7,14 +7,14 @@ from langchain_community.embeddings import EdenAiEmbeddings
|
||||
|
||||
|
||||
def test_api_key_is_string() -> None:
|
||||
llm = EdenAiEmbeddings(edenai_api_key="secret-api-key")
|
||||
llm = EdenAiEmbeddings(edenai_api_key="secret-api-key") # type: ignore[arg-type]
|
||||
assert isinstance(llm.edenai_api_key, SecretStr)
|
||||
|
||||
|
||||
def test_api_key_masked_when_passed_via_constructor(
|
||||
capsys: CaptureFixture,
|
||||
) -> None:
|
||||
llm = EdenAiEmbeddings(edenai_api_key="secret-api-key")
|
||||
llm = EdenAiEmbeddings(edenai_api_key="secret-api-key") # type: ignore[arg-type]
|
||||
print(llm.edenai_api_key, end="") # noqa: T201
|
||||
captured = capsys.readouterr()
|
||||
|
||||
|
@@ -7,14 +7,14 @@ from langchain_community.embeddings import EmbaasEmbeddings
|
||||
|
||||
|
||||
def test_api_key_is_string() -> None:
|
||||
llm = EmbaasEmbeddings(embaas_api_key="secret-api-key")
|
||||
llm = EmbaasEmbeddings(embaas_api_key="secret-api-key") # type: ignore[arg-type]
|
||||
assert isinstance(llm.embaas_api_key, SecretStr)
|
||||
|
||||
|
||||
def test_api_key_masked_when_passed_via_constructor(
|
||||
capsys: CaptureFixture,
|
||||
) -> None:
|
||||
llm = EmbaasEmbeddings(embaas_api_key="secret-api-key")
|
||||
llm = EmbaasEmbeddings(embaas_api_key="secret-api-key") # type: ignore[arg-type]
|
||||
print(llm.embaas_api_key, end="") # noqa: T201
|
||||
captured = capsys.readouterr()
|
||||
|
||||
|
@@ -3,5 +3,5 @@ from langchain_community.embeddings.huggingface import HuggingFaceInferenceAPIEm
|
||||
|
||||
def test_hugginggface_inferenceapi_embedding_documents_init() -> None:
|
||||
"""Test huggingface embeddings."""
|
||||
embedding = HuggingFaceInferenceAPIEmbeddings(api_key="abcd123")
|
||||
embedding = HuggingFaceInferenceAPIEmbeddings(api_key="abcd123") # type: ignore[arg-type]
|
||||
assert "abcd123" not in repr(embedding)
|
||||
|
@@ -7,14 +7,14 @@ from langchain_community.embeddings import LLMRailsEmbeddings
|
||||
|
||||
|
||||
def test_api_key_is_string() -> None:
|
||||
llm = LLMRailsEmbeddings(api_key="secret-api-key")
|
||||
llm = LLMRailsEmbeddings(api_key="secret-api-key") # type: ignore[arg-type]
|
||||
assert isinstance(llm.api_key, SecretStr)
|
||||
|
||||
|
||||
def test_api_key_masked_when_passed_via_constructor(
|
||||
capsys: CaptureFixture,
|
||||
) -> None:
|
||||
llm = LLMRailsEmbeddings(api_key="secret-api-key")
|
||||
llm = LLMRailsEmbeddings(api_key="secret-api-key") # type: ignore[arg-type]
|
||||
print(llm.api_key, end="") # noqa: T201
|
||||
captured = capsys.readouterr()
|
||||
|
||||
|
@@ -19,7 +19,7 @@ class MockResponseDict(dict):
|
||||
def test_embedding_call(monkeypatch: MonkeyPatch, test_model_id: str) -> None:
|
||||
"""Test valid call to OCI Generative AI embedding service."""
|
||||
oci_gen_ai_client = MagicMock()
|
||||
embeddings = OCIGenAIEmbeddings(
|
||||
embeddings = OCIGenAIEmbeddings( # type: ignore[call-arg]
|
||||
model_id=test_model_id,
|
||||
service_endpoint="https://inference.generativeai.us-chicago-1.oci.oraclecloud.com",
|
||||
client=oci_gen_ai_client,
|
||||
|
@@ -12,5 +12,5 @@ def test_openai_invalid_model_kwargs() -> None:
|
||||
@pytest.mark.requires("openai")
|
||||
def test_openai_incorrect_field() -> None:
|
||||
with pytest.warns(match="not default parameter"):
|
||||
llm = OpenAIEmbeddings(foo="bar", openai_api_key="foo")
|
||||
llm = OpenAIEmbeddings(foo="bar", openai_api_key="foo") # type: ignore[call-arg]
|
||||
assert llm.model_kwargs == {"foo": "bar"}
|
||||
|
@@ -9,8 +9,10 @@ from langchain_community.embeddings import PremAIEmbeddings
|
||||
|
||||
@pytest.mark.requires("premai")
|
||||
def test_api_key_is_string() -> None:
|
||||
llm = PremAIEmbeddings(
|
||||
premai_api_key="secret-api-key", project_id=8, model="fake-model"
|
||||
llm = PremAIEmbeddings( # type: ignore[call-arg]
|
||||
premai_api_key="secret-api-key", # type: ignore[arg-type]
|
||||
project_id=8,
|
||||
model="fake-model", # type: ignore[arg-type]
|
||||
)
|
||||
assert isinstance(llm.premai_api_key, SecretStr)
|
||||
|
||||
@@ -19,8 +21,10 @@ def test_api_key_is_string() -> None:
|
||||
def test_api_key_masked_when_passed_via_constructor(
|
||||
capsys: CaptureFixture,
|
||||
) -> None:
|
||||
llm = PremAIEmbeddings(
|
||||
premai_api_key="secret-api-key", project_id=8, model="fake-model"
|
||||
llm = PremAIEmbeddings( # type: ignore[call-arg]
|
||||
premai_api_key="secret-api-key", # type: ignore[arg-type]
|
||||
project_id=8,
|
||||
model="fake-model", # type: ignore[arg-type]
|
||||
)
|
||||
print(llm.premai_api_key, end="") # noqa: T201
|
||||
captured = capsys.readouterr()
|
||||
|
@@ -6,12 +6,12 @@ from langchain_community.embeddings import YandexGPTEmbeddings
|
||||
def test_init() -> None:
|
||||
os.environ["YC_API_KEY"] = "foo"
|
||||
models = [
|
||||
YandexGPTEmbeddings(folder_id="bar"),
|
||||
YandexGPTEmbeddings(
|
||||
YandexGPTEmbeddings(folder_id="bar"), # type: ignore[call-arg]
|
||||
YandexGPTEmbeddings( # type: ignore[call-arg]
|
||||
query_model_uri="emb://bar/text-search-query/latest",
|
||||
doc_model_uri="emb://bar/text-search-doc/latest",
|
||||
),
|
||||
YandexGPTEmbeddings(
|
||||
YandexGPTEmbeddings( # type: ignore[call-arg]
|
||||
folder_id="bar",
|
||||
query_model_name="text-search-query",
|
||||
doc_model_name="text-search-doc",
|
||||
|
Reference in New Issue
Block a user