mirror of
https://github.com/hwchase17/langchain.git
synced 2026-06-09 10:17:00 +00:00
@@ -1186,7 +1186,8 @@ class ChatAnthropic(BaseChatModel):
|
|||||||
See [Claude documentation](https://docs.claude.com/en/docs/build-with-claude/prompt-caching#1-hour-cache-duration-beta)
|
See [Claude documentation](https://docs.claude.com/en/docs/build-with-claude/prompt-caching#1-hour-cache-duration-beta)
|
||||||
for detail.
|
for detail.
|
||||||
|
|
||||||
Extended context windows (beta):
|
!!! note title="Extended context windows (beta)"
|
||||||
|
|
||||||
Claude Sonnet 4 supports a 1-million token context window, available in beta for
|
Claude Sonnet 4 supports a 1-million token context window, available in beta for
|
||||||
organizations in usage tier 4 and organizations with custom rate limits.
|
organizations in usage tier 4 and organizations with custom rate limits.
|
||||||
|
|
||||||
@@ -1221,7 +1222,8 @@ class ChatAnthropic(BaseChatModel):
|
|||||||
for detail.
|
for detail.
|
||||||
|
|
||||||
|
|
||||||
Token-efficient tool use (beta):
|
!!! note title="Token-efficient tool use (beta)"
|
||||||
|
|
||||||
See LangChain [docs](https://python.langchain.com/docs/integrations/chat/anthropic/)
|
See LangChain [docs](https://python.langchain.com/docs/integrations/chat/anthropic/)
|
||||||
for more detail.
|
for more detail.
|
||||||
|
|
||||||
@@ -1257,7 +1259,8 @@ class ChatAnthropic(BaseChatModel):
|
|||||||
Total tokens: 408
|
Total tokens: 408
|
||||||
```
|
```
|
||||||
|
|
||||||
Context management:
|
!!! note title="Context management"
|
||||||
|
|
||||||
Anthropic supports a context editing feature that will automatically manage the
|
Anthropic supports a context editing feature that will automatically manage the
|
||||||
model's context window (e.g., by clearing tool results).
|
model's context window (e.g., by clearing tool results).
|
||||||
|
|
||||||
@@ -1276,7 +1279,8 @@ class ChatAnthropic(BaseChatModel):
|
|||||||
response = model_with_tools.invoke("Search for recent developments in AI")
|
response = model_with_tools.invoke("Search for recent developments in AI")
|
||||||
```
|
```
|
||||||
|
|
||||||
Built-in tools:
|
!!! note title="Built-in tools"
|
||||||
|
|
||||||
See LangChain [docs](https://python.langchain.com/docs/integrations/chat/anthropic/#built-in-tools)
|
See LangChain [docs](https://python.langchain.com/docs/integrations/chat/anthropic/#built-in-tools)
|
||||||
for more detail.
|
for more detail.
|
||||||
|
|
||||||
@@ -1402,7 +1406,7 @@ class ChatAnthropic(BaseChatModel):
|
|||||||
response = model_with_tools.invoke("What are my interests?")
|
response = model_with_tools.invoke("What are my interests?")
|
||||||
```
|
```
|
||||||
|
|
||||||
Response metadata
|
!!! note title="Response metadata"
|
||||||
|
|
||||||
```python
|
```python
|
||||||
ai_msg = model.invoke(messages)
|
ai_msg = model.invoke(messages)
|
||||||
|
|||||||
@@ -72,12 +72,11 @@ class AzureOpenAIEmbeddings(OpenAIEmbeddings): # type: ignore[override]
|
|||||||
Embed multiple texts:
|
Embed multiple texts:
|
||||||
```python
|
```python
|
||||||
input_texts = ["Document 1...", "Document 2..."]
|
input_texts = ["Document 1...", "Document 2..."]
|
||||||
```
|
|
||||||
vectors = embed.embed_documents(input_texts)
|
vectors = embed.embed_documents(input_texts)
|
||||||
print(len(vectors))
|
print(len(vectors))
|
||||||
# The first 3 coordinates for the first vector
|
# The first 3 coordinates for the first vector
|
||||||
print(vectors[0][:3])
|
print(vectors[0][:3])
|
||||||
|
```
|
||||||
```python
|
```python
|
||||||
2
|
2
|
||||||
[-0.024603435769677162, -0.007543657906353474, 0.0039630369283258915]
|
[-0.024603435769677162, -0.007543657906353474, 0.0039630369283258915]
|
||||||
|
|||||||
Reference in New Issue
Block a user