Skip to content

Commit

Permalink
Merge branch 'master' into pprados/02-pymupdf
Browse files Browse the repository at this point in the history
  • Loading branch information
pprados authored Jan 14, 2025
2 parents acf4358 + c55af44 commit d7d3021
Show file tree
Hide file tree
Showing 11 changed files with 24 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/api_doc_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions docs/vercel_overrides.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
httpx
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions libs/cli/langchain_cli/integration_template/docs/tools.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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"
]
Expand All @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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/)"
]
},
{
Expand Down
1 change: 1 addition & 0 deletions libs/partners/anthropic/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
26 changes: 13 additions & 13 deletions libs/partners/anthropic/tests/integration_tests/test_chat_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)

Expand Down Expand Up @@ -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)
Expand All @@ -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?")]
]
Expand All @@ -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:
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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=[
Expand Down Expand Up @@ -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(
[
{
Expand Down Expand Up @@ -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]
)

Expand Down Expand Up @@ -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",
)

Expand All @@ -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 = [
Expand Down Expand Up @@ -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)
Expand All @@ -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(
[
Expand Down

0 comments on commit d7d3021

Please sign in to comment.