File tree Expand file tree Collapse file tree 6 files changed +37
-81
lines changed
Expand file tree Collapse file tree 6 files changed +37
-81
lines changed Original file line number Diff line number Diff line change @@ -37,24 +37,21 @@ integration_test:
3737
3838# Define a variable for Python and notebook files.
3939PYTHON_FILES =.
40- MYPY_CACHE =.mypy_cache
4140lint format : PYTHON_FILES=.
4241lint_diff format_diff : PYTHON_FILES=$(shell git diff --relative=libs/partners/ollama --name-only --diff-filter=d master | grep -E '\.py$$|\.ipynb$$')
4342lint_package : PYTHON_FILES=langchain_ollama
4443lint_tests : PYTHON_FILES=tests
45- lint_tests : MYPY_CACHE=.mypy_cache_test
4644UV_RUN_LINT = uv run --all-groups
47- UV_RUN_TYPE = uv run --all-groups
4845lint_package lint_tests : UV_RUN_LINT = uv run --group lint
4946
5047lint lint_diff lint_package lint_tests :
5148 ./scripts/lint_imports.sh
5249 [ " $( PYTHON_FILES) " = " " ] || $(UV_RUN_LINT ) ruff check $(PYTHON_FILES )
5350 [ " $( PYTHON_FILES) " = " " ] || $(UV_RUN_LINT ) ruff format $(PYTHON_FILES ) --diff
54- [ " $( PYTHON_FILES ) " = " " ] || mkdir -p $( MYPY_CACHE ) && $( UV_RUN_TYPE ) mypy $( PYTHON_FILES ) --cache-dir $( MYPY_CACHE )
51+ $( MAKE ) type
5552
5653type :
57- mkdir -p $( MYPY_CACHE ) && $( UV_RUN_TYPE ) mypy $( PYTHON_FILES ) --cache-dir $( MYPY_CACHE )
54+ uv run --all-groups ty check langchain_ollama
5855
5956format format_diff :
6057 [ " $( PYTHON_FILES) " = " " ] || $(UV_RUN_LINT ) ruff format $(PYTHON_FILES )
Original file line number Diff line number Diff line change 1515
1616from importlib import metadata
1717from importlib .metadata import PackageNotFoundError
18+ from typing import NoReturn
1819
1920from langchain_ollama .chat_models import ChatOllama
2021from langchain_ollama .embeddings import OllamaEmbeddings
2122from langchain_ollama .llms import OllamaLLM
2223
2324
24- def _raise_package_not_found_error () -> None :
25+ def _raise_package_not_found_error () -> NoReturn :
2526 raise PackageNotFoundError
2627
2728
Original file line number Diff line number Diff line change @@ -1539,7 +1539,7 @@ class AnswerWithJustification(BaseModel):
15391539 )
15401540 if is_pydantic_schema :
15411541 output_parser : Runnable = PydanticToolsParser (
1542- tools = [schema ], # type : ignore[list-item ]
1542+ tools = [schema ], # ty : ignore[invalid-argument-type ]
15431543 first_tool_only = True ,
15441544 )
15451545 else :
@@ -1555,7 +1555,7 @@ class AnswerWithJustification(BaseModel):
15551555 },
15561556 )
15571557 output_parser = (
1558- PydanticOutputParser (pydantic_object = schema ) # type : ignore[arg -type]
1558+ PydanticOutputParser (pydantic_object = schema ) # ty : ignore[invalid-argument -type]
15591559 if is_pydantic_schema
15601560 else JsonOutputParser ()
15611561 )
@@ -1579,7 +1579,7 @@ class AnswerWithJustification(BaseModel):
15791579 "schema" : schema ,
15801580 },
15811581 )
1582- output_parser = PydanticOutputParser (pydantic_object = schema ) # type: ignore[arg-type]
1582+ output_parser = PydanticOutputParser (pydantic_object = schema )
15831583 else :
15841584 if is_typeddict (schema ):
15851585 response_format = convert_to_json_schema (schema )
Original file line number Diff line number Diff line change @@ -475,7 +475,7 @@ def _generate(
475475 ** kwargs ,
476476 )
477477 generations .append ([final_chunk ])
478- return LLMResult (generations = generations ) # type: ignore[arg-type]
478+ return LLMResult (generations = generations )
479479
480480 async def _agenerate (
481481 self ,
@@ -494,7 +494,7 @@ async def _agenerate(
494494 ** kwargs ,
495495 )
496496 generations .append ([final_chunk ])
497- return LLMResult (generations = generations ) # type: ignore[arg-type]
497+ return LLMResult (generations = generations )
498498
499499 def _stream (
500500 self ,
Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ test_integration = []
5151lint = [" ruff>=0.13.1,<0.14.0" ]
5252dev = [" langchain-core" ]
5353typing = [
54- " mypy>=1.17 .1,<2 .0.0" ,
54+ " ty>=0.0 .1,<1 .0.0" ,
5555 " langchain-core"
5656]
5757
@@ -62,9 +62,6 @@ constraint-dependencies = ["pygments>=2.20.0"]
6262langchain-core = { path = " ../../core" , editable = true }
6363langchain-tests = { path = " ../../standard-tests" , editable = true }
6464
65- [tool .mypy ]
66- disallow_untyped_defs = " True"
67-
6865[tool .ruff .format ]
6966docstring-code-format = true
7067docstring-code-line-length = 100
You can’t perform that action at this time.
0 commit comments