mirror of
https://github.com/hwchase17/langchain.git
synced 2026-06-09 10:17:00 +00:00
release(xai): 1.2.2 (#34880)
This commit is contained in:
@@ -9,11 +9,11 @@ license = { text = "MIT" }
|
|||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
authors = []
|
authors = []
|
||||||
|
|
||||||
version = "1.2.1"
|
version = "1.2.2"
|
||||||
requires-python = ">=3.10.0,<4.0.0"
|
requires-python = ">=3.10.0,<4.0.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"langchain-openai>=1.1.6,<2.0.0",
|
"langchain-openai>=1.1.7,<2.0.0",
|
||||||
"langchain-core>=1.2.6,<2.0.0",
|
"langchain-core>=1.2.7,<2.0.0",
|
||||||
"requests>=2.0.0,<3.0.0",
|
"requests>=2.0.0,<3.0.0",
|
||||||
"aiohttp>=3.9.1,<4.0.0",
|
"aiohttp>=3.9.1,<4.0.0",
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -95,21 +95,21 @@ def test_reasoning(output_version: Literal["", "v1"]) -> None:
|
|||||||
|
|
||||||
|
|
||||||
def test_web_search() -> None:
|
def test_web_search() -> None:
|
||||||
llm = ChatXAI(
|
llm = ChatXAI(model=MODEL_NAME).bind_tools([{"type": "web_search"}])
|
||||||
model=MODEL_NAME,
|
|
||||||
search_parameters={"mode": "on", "max_search_results": 3},
|
|
||||||
)
|
|
||||||
|
|
||||||
# Test invoke
|
# Test invoke
|
||||||
response = llm.invoke("Provide me a digest of world news in the last 24 hours.")
|
response = llm.invoke("Look up the current time in Boston, MA.")
|
||||||
assert response.content
|
assert response.content
|
||||||
assert response.additional_kwargs["citations"]
|
content_types = {block["type"] for block in response.content_blocks}
|
||||||
assert len(response.additional_kwargs["citations"]) <= 3
|
assert content_types == {"server_tool_call", "server_tool_result", "text"}
|
||||||
|
assert response.content_blocks[0]["name"] == "web_search" # type: ignore[typeddict-item]
|
||||||
|
|
||||||
# Test streaming
|
# Test streaming
|
||||||
full = None
|
full: AIMessageChunk | None = None
|
||||||
for chunk in llm.stream("Provide me a digest of world news in the last 24 hours."):
|
for chunk in llm.stream("Look up the current time in Boston, MA."):
|
||||||
|
assert isinstance(chunk, AIMessageChunk)
|
||||||
full = chunk if full is None else full + chunk
|
full = chunk if full is None else full + chunk
|
||||||
assert isinstance(full, AIMessageChunk)
|
assert isinstance(full, AIMessageChunk)
|
||||||
assert full.additional_kwargs["citations"]
|
content_types = {block["type"] for block in full.content_blocks}
|
||||||
assert len(full.additional_kwargs["citations"]) <= 3
|
assert content_types == {"server_tool_call", "server_tool_result", "text"}
|
||||||
|
assert full.content_blocks[0]["name"] == "web_search" # type: ignore[typeddict-item]
|
||||||
|
|||||||
8
libs/partners/xai/uv.lock
generated
8
libs/partners/xai/uv.lock
generated
@@ -1,5 +1,5 @@
|
|||||||
version = 1
|
version = 1
|
||||||
revision = 3
|
revision = 2
|
||||||
requires-python = ">=3.10.0, <4.0.0"
|
requires-python = ">=3.10.0, <4.0.0"
|
||||||
resolution-markers = [
|
resolution-markers = [
|
||||||
"python_full_version >= '3.13' and platform_python_implementation == 'PyPy'",
|
"python_full_version >= '3.13' and platform_python_implementation == 'PyPy'",
|
||||||
@@ -672,7 +672,7 @@ dependencies = [
|
|||||||
requires-dist = [
|
requires-dist = [
|
||||||
{ name = "jsonpatch", specifier = ">=1.33.0,<2.0.0" },
|
{ name = "jsonpatch", specifier = ">=1.33.0,<2.0.0" },
|
||||||
{ name = "langsmith", specifier = ">=0.3.45,<1.0.0" },
|
{ name = "langsmith", specifier = ">=0.3.45,<1.0.0" },
|
||||||
{ name = "packaging", specifier = ">=23.2.0,<26.0.0" },
|
{ name = "packaging", specifier = ">=23.2.0" },
|
||||||
{ name = "pydantic", specifier = ">=2.7.4,<3.0.0" },
|
{ name = "pydantic", specifier = ">=2.7.4,<3.0.0" },
|
||||||
{ name = "pyyaml", specifier = ">=5.3.0,<7.0.0" },
|
{ name = "pyyaml", specifier = ">=5.3.0,<7.0.0" },
|
||||||
{ name = "tenacity", specifier = ">=8.1.0,!=8.4.0,<10.0.0" },
|
{ name = "tenacity", specifier = ">=8.1.0,!=8.4.0,<10.0.0" },
|
||||||
@@ -684,7 +684,7 @@ requires-dist = [
|
|||||||
dev = [
|
dev = [
|
||||||
{ name = "grandalf", specifier = ">=0.8.0,<1.0.0" },
|
{ name = "grandalf", specifier = ">=0.8.0,<1.0.0" },
|
||||||
{ name = "jupyter", specifier = ">=1.0.0,<2.0.0" },
|
{ name = "jupyter", specifier = ">=1.0.0,<2.0.0" },
|
||||||
{ name = "setuptools", specifier = ">=67.6.1,<68.0.0" },
|
{ name = "setuptools", specifier = ">=67.6.1,<79.0.0" },
|
||||||
]
|
]
|
||||||
lint = [{ name = "ruff", specifier = ">=0.14.11,<0.15.0" }]
|
lint = [{ name = "ruff", specifier = ">=0.14.11,<0.15.0" }]
|
||||||
test = [
|
test = [
|
||||||
@@ -810,7 +810,7 @@ typing = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "langchain-xai"
|
name = "langchain-xai"
|
||||||
version = "1.2.1"
|
version = "1.2.2"
|
||||||
source = { editable = "." }
|
source = { editable = "." }
|
||||||
dependencies = [
|
dependencies = [
|
||||||
{ name = "aiohttp" },
|
{ name = "aiohttp" },
|
||||||
|
|||||||
Reference in New Issue
Block a user