langchain 1.0.2__py3-none-any.whl → 1.0.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of langchain might be problematic. Click here for more details.

@@ -1,4 +1,4 @@
1
- """Embeddings.
1
+ """Embeddings models.
2
2
 
3
3
  !!! warning "Reference docs"
4
4
  This page contains **reference documentation** for Embeddings. See
@@ -126,26 +126,27 @@ def init_embeddings(
126
126
  provider: str | None = None,
127
127
  **kwargs: Any,
128
128
  ) -> Embeddings:
129
- """Initialize an embeddings model from a model name and optional provider.
129
+ """Initialize an embedding model from a model name and optional provider.
130
130
 
131
131
  !!! note
132
- Must have the integration package corresponding to the model provider
133
- installed.
132
+ Requires the integration package for the chosen model provider to be installed.
134
133
 
135
- Args:
136
- model: Name of the model to use.
134
+ See the `model_provider` parameter below for specific package names
135
+ (e.g., `pip install langchain-openai`).
137
136
 
138
- Can be either:
137
+ Refer to the [provider integration's API reference](https://docs.langchain.com/oss/python/integrations/providers)
138
+ for supported model parameters to use as `**kwargs`.
139
139
 
140
- - A model string like `"openai:text-embedding-3-small"`
141
- - Just the model name if the provider is specified separately or can be
142
- inferred.
140
+ Args:
141
+ model: The name of the model, e.g. `'openai:text-embedding-3-small'`.
143
142
 
144
- See supported providers under the `provider` arg description.
145
- provider: Optional explicit provider name. If not specified, will attempt to
146
- parse from the model string in the `model` arg.
143
+ You can also specify model and model provider in a single argument using
144
+ `'{model_provider}:{model}'` format, e.g. `'openai:text-embedding-3-small'`.
145
+ provider: The model provider if not specified as part of the model arg
146
+ (see above).
147
147
 
148
- Supported providers:
148
+ Supported `provider` values and the corresponding integration package
149
+ are:
149
150
 
150
151
  - `openai` -> [`langchain-openai`](https://docs.langchain.com/oss/python/integrations/providers/openai)
151
152
  - `azure_openai` -> [`langchain-openai`](https://docs.langchain.com/oss/python/integrations/providers/openai)
@@ -157,7 +158,10 @@ def init_embeddings(
157
158
  - `ollama` -> [`langchain-ollama`](https://docs.langchain.com/oss/python/integrations/providers/ollama)
158
159
 
159
160
  **kwargs: Additional model-specific parameters passed to the embedding model.
160
- These vary by provider, see the provider-specific documentation for details.
161
+
162
+ These vary by provider. Refer to the specific model provider's
163
+ [integration reference](https://reference.langchain.com/python/integrations/)
164
+ for all available parameters.
161
165
 
162
166
  Returns:
163
167
  An `Embeddings` instance that can generate embeddings for text.
@@ -166,9 +170,11 @@ def init_embeddings(
166
170
  ValueError: If the model provider is not supported or cannot be determined
167
171
  ImportError: If the required provider package is not installed
168
172
 
169
- ???+ note "Example Usage"
173
+ ???+ example
170
174
 
171
175
  ```python
176
+ # pip install langchain langchain-openai
177
+
172
178
  # Using a model string
173
179
  model = init_embeddings("openai:text-embedding-3-small")
174
180
  model.embed_query("Hello, world!")
@@ -1,4 +1,4 @@
1
- """Message types.
1
+ """Message and message content types.
2
2
 
3
3
  Includes message types for different roles (e.g., human, AI, system), as well as types
4
4
  for message content blocks (e.g., text, image, audio) and tool calls.
@@ -21,10 +21,12 @@ from langchain_core.messages import (
21
21
  FileContentBlock,
22
22
  HumanMessage,
23
23
  ImageContentBlock,
24
+ InputTokenDetails,
24
25
  InvalidToolCall,
25
26
  MessageLikeRepresentation,
26
27
  NonStandardAnnotation,
27
28
  NonStandardContentBlock,
29
+ OutputTokenDetails,
28
30
  PlainTextContentBlock,
29
31
  ReasoningContentBlock,
30
32
  RemoveMessage,
@@ -36,6 +38,7 @@ from langchain_core.messages import (
36
38
  ToolCall,
37
39
  ToolCallChunk,
38
40
  ToolMessage,
41
+ UsageMetadata,
39
42
  VideoContentBlock,
40
43
  trim_messages,
41
44
  )
@@ -52,10 +55,12 @@ __all__ = [
52
55
  "FileContentBlock",
53
56
  "HumanMessage",
54
57
  "ImageContentBlock",
58
+ "InputTokenDetails",
55
59
  "InvalidToolCall",
56
60
  "MessageLikeRepresentation",
57
61
  "NonStandardAnnotation",
58
62
  "NonStandardContentBlock",
63
+ "OutputTokenDetails",
59
64
  "PlainTextContentBlock",
60
65
  "ReasoningContentBlock",
61
66
  "RemoveMessage",
@@ -67,6 +72,7 @@ __all__ = [
67
72
  "ToolCall",
68
73
  "ToolCallChunk",
69
74
  "ToolMessage",
75
+ "UsageMetadata",
70
76
  "VideoContentBlock",
71
77
  "trim_messages",
72
78
  ]