Skip to content

The agent engineering platform.

refactor(anthropic): remove unnecessary url check (#33671)

Arun Prasadb3934b95807a
diff --git a/libs/partners/anthropic/langchain_anthropic/_compat.py b/libs/partners/anthropic/langchain_anthropic/_compat.py
index c86ceef3dc..d16f5c7727 100644
--- a/libs/partners/anthropic/langchain_anthropic/_compat.py
+++ b/libs/partners/anthropic/langchain_anthropic/_compat.py
@@ -22,8 +22,7 @@ def _convert_annotation_from_v1(annotation: types.Annotation) -> dict[str, Any]:
if "title" in annotation:
out["title"] = annotation["title"]
out["type"] = "web_search_result_location"
- if "url" in annotation:
- out["url"] = annotation["url"]
+ out["url"] = annotation.get("url")
for key, value in annotation.get("extras", {}).items():
if key not in out: