diff --git a/.github/workflows/api_doc_build.yml b/.github/workflows/api_doc_build.yml index 28ad2d742367a..42007cb1d9a2d 100644 --- a/.github/workflows/api_doc_build.yml +++ b/.github/workflows/api_doc_build.yml @@ -72,7 +72,7 @@ jobs: - name: Install dependencies working-directory: langchain run: | - python -m uv pip install $(ls ./libs/partners | xargs -I {} echo "./libs/partners/{}") + python -m uv pip install $(ls ./libs/partners | xargs -I {} echo "./libs/partners/{}") --overrides ./docs/vercel_overrides.txt python -m uv pip install libs/core libs/langchain libs/text-splitters libs/community libs/experimental libs/standard-tests python -m uv pip install -r docs/api_reference/requirements.txt diff --git a/docs/Makefile b/docs/Makefile index 5df104397aade..43fb70bb105ed 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -27,7 +27,7 @@ install-py-deps: $(PYTHON) -m pip install -q --upgrade pip $(PYTHON) -m pip install -q --upgrade uv $(PYTHON) -m uv pip install -q --pre -r vercel_requirements.txt - $(PYTHON) -m uv pip install -q --pre $$($(PYTHON) scripts/partner_deps_list.py) + $(PYTHON) -m uv pip install -q --pre $$($(PYTHON) scripts/partner_deps_list.py) --overrides vercel_overrides.txt generate-files: mkdir -p $(INTERMEDIATE_DIR) diff --git a/docs/vercel_overrides.txt b/docs/vercel_overrides.txt new file mode 100644 index 0000000000000..79228389fce46 --- /dev/null +++ b/docs/vercel_overrides.txt @@ -0,0 +1 @@ +httpx \ No newline at end of file diff --git a/libs/cli/langchain_cli/integration_template/docs/chat.ipynb b/libs/cli/langchain_cli/integration_template/docs/chat.ipynb index 95ac5d9c5d3a8..c0dbef513554b 100644 --- a/libs/cli/langchain_cli/integration_template/docs/chat.ipynb +++ b/libs/cli/langchain_cli/integration_template/docs/chat.ipynb @@ -19,7 +19,7 @@ "\n", "- TODO: Make sure API reference link is correct.\n", "\n", - "This will help you getting started with __ModuleName__ [chat models](/docs/concepts/#chat-models). For detailed documentation of all Chat__ModuleName__ features and configurations head to the [API reference](https://api.python.langchain.com/en/latest/chat_models/__module_name__.chat_models.Chat__ModuleName__.html).\n", + "This will help you getting started with __ModuleName__ [chat models](/docs/concepts/chat_models). For detailed documentation of all Chat__ModuleName__ features and configurations head to the [API reference](https://api.python.langchain.com/en/latest/chat_models/__module_name__.chat_models.Chat__ModuleName__.html).\n", "\n", "- TODO: Add any other relevant links, like information about models, prices, context windows, etc. See https://python.langchain.com/docs/integrations/chat/openai/ for an example.\n", "\n", diff --git a/libs/cli/langchain_cli/integration_template/docs/document_loaders.ipynb b/libs/cli/langchain_cli/integration_template/docs/document_loaders.ipynb index e457102b5cf91..67ac60d249f92 100644 --- a/libs/cli/langchain_cli/integration_template/docs/document_loaders.ipynb +++ b/libs/cli/langchain_cli/integration_template/docs/document_loaders.ipynb @@ -17,7 +17,7 @@ "\n", "- TODO: Make sure API reference link is correct.\n", "\n", - "This notebook provides a quick overview for getting started with __ModuleName__ [document loader](https://python.langchain.com/docs/concepts/#document-loaders). For detailed documentation of all __ModuleName__Loader features and configurations head to the [API reference](https://python.langchain.com/v0.2/api_reference/community/document_loaders/langchain_community.document_loaders.__module_name___loader.__ModuleName__Loader.html).\n", + "This notebook provides a quick overview for getting started with __ModuleName__ [document loader](https://python.langchain.com/docs/concepts/document_loaders). For detailed documentation of all __ModuleName__Loader features and configurations head to the [API reference](https://python.langchain.com/v0.2/api_reference/community/document_loaders/langchain_community.document_loaders.__module_name___loader.__ModuleName__Loader.html).\n", "\n", "- TODO: Add any other relevant links, like information about underlying API, etc.\n", "\n", diff --git a/libs/cli/langchain_cli/integration_template/docs/retrievers.ipynb b/libs/cli/langchain_cli/integration_template/docs/retrievers.ipynb index 78f779301b11c..20d36e4f09f65 100644 --- a/libs/cli/langchain_cli/integration_template/docs/retrievers.ipynb +++ b/libs/cli/langchain_cli/integration_template/docs/retrievers.ipynb @@ -19,7 +19,7 @@ "\n", "- TODO: Make sure API reference link is correct.\n", "\n", - "This will help you getting started with the __ModuleName__ [retriever](/docs/concepts/#retrievers). For detailed documentation of all __ModuleName__Retriever features and configurations head to the [API reference](https://api.python.langchain.com/en/latest/retrievers/__module_name__.retrievers.__ModuleName__.__ModuleName__Retriever.html).\n", + "This will help you getting started with the __ModuleName__ [retriever](/docs/concepts/retrievers). For detailed documentation of all __ModuleName__Retriever features and configurations head to the [API reference](https://api.python.langchain.com/en/latest/retrievers/__module_name__.retrievers.__ModuleName__.__ModuleName__Retriever.html).\n", "\n", "### Integration details\n", "\n", diff --git a/libs/cli/langchain_cli/integration_template/docs/toolkits.ipynb b/libs/cli/langchain_cli/integration_template/docs/toolkits.ipynb index da948c899a093..23fbd2903cd27 100644 --- a/libs/cli/langchain_cli/integration_template/docs/toolkits.ipynb +++ b/libs/cli/langchain_cli/integration_template/docs/toolkits.ipynb @@ -19,7 +19,7 @@ "\n", "- TODO: Make sure API reference link is correct.\n", "\n", - "This will help you getting started with the __ModuleName__ [toolkit](/docs/concepts/#toolkits). For detailed documentation of all __ModuleName__Toolkit features and configurations head to the [API reference](https://api.python.langchain.com/en/latest/agent_toolkits/__module_name__.agent_toolkits.__ModuleName__.toolkit.__ModuleName__Toolkit.html).\n", + "This will help you getting started with the __ModuleName__ [toolkit](/docs/concepts/tools/#toolkits). For detailed documentation of all __ModuleName__Toolkit features and configurations head to the [API reference](https://api.python.langchain.com/en/latest/agent_toolkits/__module_name__.agent_toolkits.__ModuleName__.toolkit.__ModuleName__Toolkit.html).\n", "\n", "## Setup\n", "\n", diff --git a/libs/cli/langchain_cli/integration_template/docs/tools.ipynb b/libs/cli/langchain_cli/integration_template/docs/tools.ipynb index f1e02ca844f3f..7ca2ac5378d56 100644 --- a/libs/cli/langchain_cli/integration_template/docs/tools.ipynb +++ b/libs/cli/langchain_cli/integration_template/docs/tools.ipynb @@ -132,7 +132,7 @@ "source": [ "## Invocation\n", "\n", - "### [Invoke directly with args](/docs/concepts/#invoke-with-just-the-arguments)\n", + "### [Invoke directly with args](/docs/concepts/tools/#use-the-tool-directly)\n", "\n", "- TODO: Describe what the tool args are, fill them in, run cell" ] @@ -152,7 +152,7 @@ "id": "d6e73897", "metadata": {}, "source": [ - "### [Invoke with ToolCall](/docs/concepts/#invoke-with-toolcall)\n", + "### [Invoke with ToolCall](/docs/concepts/tool_calling/#tool-execution)\n", "\n", "We can also invoke the tool with a model-generated ToolCall, in which case a ToolMessage will be returned:\n", "\n", diff --git a/libs/cli/langchain_cli/integration_template/docs/vectorstores.ipynb b/libs/cli/langchain_cli/integration_template/docs/vectorstores.ipynb index 2ae2da87291bc..bbf0b85a2fafa 100644 --- a/libs/cli/langchain_cli/integration_template/docs/vectorstores.ipynb +++ b/libs/cli/langchain_cli/integration_template/docs/vectorstores.ipynb @@ -294,7 +294,7 @@ "\n", "- [Tutorials](/docs/tutorials/)\n", "- [How-to: Question and answer with RAG](https://python.langchain.com/docs/how_to/#qa-with-rag)\n", - "- [Retrieval conceptual docs](https://python.langchain.com/docs/concepts/#retrieval)" + "- [Retrieval conceptual docs](https://python.langchain.com/docs/concepts/retrieval/)" ] }, { diff --git a/libs/partners/anthropic/pyproject.toml b/libs/partners/anthropic/pyproject.toml index abe04e73dae8d..645f6b5d604fa 100644 --- a/libs/partners/anthropic/pyproject.toml +++ b/libs/partners/anthropic/pyproject.toml @@ -13,6 +13,7 @@ license = "MIT" [tool.mypy] disallow_untyped_defs = "True" +plugins = ['pydantic.mypy'] [tool.poetry.urls] "Source Code" = "https://github.com/langchain-ai/langchain/tree/master/libs/partners/anthropic" diff --git a/libs/partners/anthropic/tests/integration_tests/test_chat_models.py b/libs/partners/anthropic/tests/integration_tests/test_chat_models.py index 2fdf71845636f..9f2eaba45549d 100644 --- a/libs/partners/anthropic/tests/integration_tests/test_chat_models.py +++ b/libs/partners/anthropic/tests/integration_tests/test_chat_models.py @@ -153,7 +153,7 @@ async def test_abatch_tags() -> None: async def test_async_tool_use() -> None: - llm = ChatAnthropic( # type: ignore[call-arg] + llm = ChatAnthropic( model=MODEL_NAME, ) @@ -249,7 +249,7 @@ def test_system_invoke() -> None: def test_anthropic_call() -> None: """Test valid call to anthropic.""" - chat = ChatAnthropic(model=MODEL_NAME) # type: ignore[call-arg] + chat = ChatAnthropic(model=MODEL_NAME) message = HumanMessage(content="Hello") response = chat.invoke([message]) assert isinstance(response, AIMessage) @@ -258,7 +258,7 @@ def test_anthropic_call() -> None: def test_anthropic_generate() -> None: """Test generate method of anthropic.""" - chat = ChatAnthropic(model=MODEL_NAME) # type: ignore[call-arg] + chat = ChatAnthropic(model=MODEL_NAME) chat_messages: List[List[BaseMessage]] = [ [HumanMessage(content="How many toes do dogs have?")] ] @@ -274,7 +274,7 @@ def test_anthropic_generate() -> None: def test_anthropic_streaming() -> None: """Test streaming tokens from anthropic.""" - chat = ChatAnthropic(model=MODEL_NAME) # type: ignore[call-arg] + chat = ChatAnthropic(model=MODEL_NAME) message = HumanMessage(content="Hello") response = chat.stream([message]) for token in response: @@ -286,7 +286,7 @@ def test_anthropic_streaming_callback() -> None: """Test that streaming correctly invokes on_llm_new_token callback.""" callback_handler = FakeCallbackHandler() callback_manager = CallbackManager([callback_handler]) - chat = ChatAnthropic( # type: ignore[call-arg] + chat = ChatAnthropic( model=MODEL_NAME, callback_manager=callback_manager, verbose=True, @@ -302,7 +302,7 @@ async def test_anthropic_async_streaming_callback() -> None: """Test that streaming correctly invokes on_llm_new_token callback.""" callback_handler = FakeCallbackHandler() callback_manager = CallbackManager([callback_handler]) - chat = ChatAnthropic( # type: ignore[call-arg] + chat = ChatAnthropic( model=MODEL_NAME, callback_manager=callback_manager, verbose=True, @@ -318,7 +318,7 @@ async def test_anthropic_async_streaming_callback() -> None: def test_anthropic_multimodal() -> None: """Test that multimodal inputs are handled correctly.""" - chat = ChatAnthropic(model=MODEL_NAME) # type: ignore[call-arg] + chat = ChatAnthropic(model=MODEL_NAME) messages: list[BaseMessage] = [ HumanMessage( content=[ @@ -369,7 +369,7 @@ async def test_astreaming() -> None: def test_tool_use() -> None: - llm = ChatAnthropic(model=MODEL_NAME) # type: ignore[call-arg] + llm = ChatAnthropic(model=MODEL_NAME) llm_with_tools = llm.bind_tools( [ { @@ -452,7 +452,7 @@ def type_letter(letter: str) -> str: """Type the given letter.""" return "OK" - model = ChatAnthropic(model="claude-3-opus-20240229", temperature=0).bind_tools( # type: ignore[call-arg] + model = ChatAnthropic(model="claude-3-opus-20240229", temperature=0).bind_tools( [type_letter] ) @@ -490,7 +490,7 @@ def type_letter(letter: str) -> str: def test_with_structured_output() -> None: - llm = ChatAnthropic( # type: ignore[call-arg] + llm = ChatAnthropic( model="claude-3-opus-20240229", ) @@ -510,7 +510,7 @@ def test_with_structured_output() -> None: def test_get_num_tokens_from_messages() -> None: - llm = ChatAnthropic(model="claude-3-5-sonnet-20241022") # type: ignore[call-arg] + llm = ChatAnthropic(model="claude-3-5-sonnet-20241022") # Test simple case messages = [ @@ -571,7 +571,7 @@ class GetWeather(BaseModel): @pytest.mark.parametrize("tool_choice", ["GetWeather", "auto", "any"]) def test_anthropic_bind_tools_tool_choice(tool_choice: str) -> None: - chat_model = ChatAnthropic( # type: ignore[call-arg] + chat_model = ChatAnthropic( model=MODEL_NAME, ) chat_model_with_tools = chat_model.bind_tools([GetWeather], tool_choice=tool_choice) @@ -583,7 +583,7 @@ def test_pdf_document_input() -> None: url = "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf" data = b64encode(requests.get(url).content).decode() - result = ChatAnthropic(model_name=MODEL_NAME).invoke( # type: ignore[call-arg] + result = ChatAnthropic(model=MODEL_NAME).invoke( [ HumanMessage( [