Skip to content

Commit f94108b

Browse files
authored
fix: links (#33691)
* X-ref to new docs * Formatting updates
1 parent 60a0ff8 commit f94108b

File tree

23 files changed

+103
-49
lines changed

23 files changed

+103
-49
lines changed

libs/core/langchain_core/exceptions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,6 @@ def create_message(*, message: str, error_code: ErrorCode) -> str:
8686
"""
8787
return (
8888
f"{message}\n"
89-
"For troubleshooting, visit: https://python.langchain.com/docs/"
90-
f"troubleshooting/errors/{error_code.value} "
89+
"For troubleshooting, visit: https://docs.langchain.com/oss/python/langchain"
90+
f"/errors/{error_code.value} "
9191
)

libs/core/langchain_core/language_models/llms.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1391,11 +1391,6 @@ class LLM(BaseLLM):
13911391
`astream` will use `_astream` if provided, otherwise it will implement
13921392
a fallback behavior that will use `_stream` if `_stream` is implemented,
13931393
and use `_acall` if `_stream` is not implemented.
1394-
1395-
Please see the following guide for more information on how to
1396-
implement a custom LLM:
1397-
1398-
https://python.langchain.com/docs/how_to/custom_llm/
13991394
"""
14001395

14011396
@abstractmethod

libs/core/langchain_core/messages/ai.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,14 +124,18 @@ class UsageMetadata(TypedDict):
124124
!!! warning "Behavior changed in 0.3.9"
125125
Added `input_token_details` and `output_token_details`.
126126
127+
!!! note "LangSmith SDK"
128+
The LangSmith SDK also has a `UsageMetadata` class. While the two share fields,
129+
LangSmith's `UsageMetadata` has additional fields to capture cost information
130+
used by the LangSmith platform.
127131
"""
128132

129133
input_tokens: int
130134
"""Count of input (or prompt) tokens. Sum of all input token types."""
131135
output_tokens: int
132136
"""Count of output (or completion) tokens. Sum of all output token types."""
133137
total_tokens: int
134-
"""Total token count. Sum of input_tokens + output_tokens."""
138+
"""Total token count. Sum of `input_tokens` + `output_tokens`."""
135139
input_token_details: NotRequired[InputTokenDetails]
136140
"""Breakdown of input token counts.
137141
@@ -141,7 +145,6 @@ class UsageMetadata(TypedDict):
141145
"""Breakdown of output token counts.
142146
143147
Does *not* need to sum to full output token count. Does *not* need to have all keys.
144-
145148
"""
146149

147150

@@ -153,7 +156,6 @@ class AIMessage(BaseMessage):
153156
This message represents the output of the model and consists of both
154157
the raw output as returned by the model and standardized fields
155158
(e.g., tool calls, usage metadata) added by the LangChain framework.
156-
157159
"""
158160

159161
tool_calls: list[ToolCall] = []

libs/core/langchain_core/outputs/generation.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,8 @@
1111
class Generation(Serializable):
1212
"""A single text generation output.
1313
14-
Generation represents the response from an
15-
`"old-fashioned" LLM <https://python.langchain.com/docs/concepts/text_llms/>__` that
16-
generates regular text (not chat messages).
14+
Generation represents the response from an "old-fashioned" LLM (string-in,
15+
string-out) that generates regular text (not chat messages).
1716
1817
This model is used internally by chat model and will eventually
1918
be mapped to a more general `LLMResult` object, and then projected into

libs/core/langchain_core/utils/utils.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ def _build_model_kwargs(
218218
values: dict[str, Any],
219219
all_required_field_names: set[str],
220220
) -> dict[str, Any]:
221-
"""Build "model_kwargs" param from Pydantic constructor values.
221+
"""Build `model_kwargs` param from Pydantic constructor values.
222222
223223
Args:
224224
values: All init args passed in by user.
@@ -228,8 +228,8 @@ def _build_model_kwargs(
228228
Extra kwargs.
229229
230230
Raises:
231-
ValueError: If a field is specified in both values and extra_kwargs.
232-
ValueError: If a field is specified in model_kwargs.
231+
ValueError: If a field is specified in both `values` and `extra_kwargs`.
232+
ValueError: If a field is specified in `model_kwargs`.
233233
"""
234234
extra_kwargs = values.get("model_kwargs", {})
235235
for field_name in list(values):
@@ -267,6 +267,10 @@ def build_extra_kwargs(
267267
) -> dict[str, Any]:
268268
"""Build extra kwargs from values and extra_kwargs.
269269
270+
!!! danger "DON'T USE"
271+
Kept for backwards-compatibility but should never have been public. Use the
272+
internal `_build_model_kwargs` function instead.
273+
270274
Args:
271275
extra_kwargs: Extra kwargs passed in by user.
272276
values: Values passed in by user.
@@ -276,9 +280,10 @@ def build_extra_kwargs(
276280
Extra kwargs.
277281
278282
Raises:
279-
ValueError: If a field is specified in both values and extra_kwargs.
280-
ValueError: If a field is specified in model_kwargs.
283+
ValueError: If a field is specified in both `values` and `extra_kwargs`.
284+
ValueError: If a field is specified in `model_kwargs`.
281285
"""
286+
# DON'T USE! Kept for backwards-compatibility but should never have been public.
282287
for field_name in list(values):
283288
if field_name in extra_kwargs:
284289
msg = f"Found {field_name} supplied twice."
@@ -292,6 +297,7 @@ def build_extra_kwargs(
292297
)
293298
extra_kwargs[field_name] = values.pop(field_name)
294299

300+
# DON'T USE! Kept for backwards-compatibility but should never have been public.
295301
invalid_model_kwargs = all_required_field_names.intersection(extra_kwargs.keys())
296302
if invalid_model_kwargs:
297303
msg = (
@@ -300,6 +306,7 @@ def build_extra_kwargs(
300306
)
301307
raise ValueError(msg)
302308

309+
# DON'T USE! Kept for backwards-compatibility but should never have been public.
303310
return extra_kwargs
304311

305312

libs/core/tests/unit_tests/prompts/__snapshots__/test_chat.ambr

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1319,6 +1319,11 @@
13191319

13201320
!!! warning "Behavior changed in 0.3.9"
13211321
Added `input_token_details` and `output_token_details`.
1322+
1323+
!!! note "LangSmith SDK"
1324+
The LangSmith SDK also has a `UsageMetadata` class. While the two share fields,
1325+
LangSmith's `UsageMetadata` has additional fields to capture cost information
1326+
used by the LangSmith platform.
13221327
''',
13231328
'properties': dict({
13241329
'input_token_details': dict({
@@ -2726,6 +2731,11 @@
27262731

27272732
!!! warning "Behavior changed in 0.3.9"
27282733
Added `input_token_details` and `output_token_details`.
2734+
2735+
!!! note "LangSmith SDK"
2736+
The LangSmith SDK also has a `UsageMetadata` class. While the two share fields,
2737+
LangSmith's `UsageMetadata` has additional fields to capture cost information
2738+
used by the LangSmith platform.
27292739
''',
27302740
'properties': dict({
27312741
'input_token_details': dict({

libs/core/tests/unit_tests/runnables/__snapshots__/test_graph.ambr

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1743,6 +1743,11 @@
17431743

17441744
!!! warning "Behavior changed in 0.3.9"
17451745
Added `input_token_details` and `output_token_details`.
1746+
1747+
!!! note "LangSmith SDK"
1748+
The LangSmith SDK also has a `UsageMetadata` class. While the two share fields,
1749+
LangSmith's `UsageMetadata` has additional fields to capture cost information
1750+
used by the LangSmith platform.
17461751
''',
17471752
'properties': dict({
17481753
'input_token_details': dict({

libs/core/tests/unit_tests/runnables/__snapshots__/test_runnable.ambr

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3259,6 +3259,11 @@
32593259

32603260
!!! warning "Behavior changed in 0.3.9"
32613261
Added `input_token_details` and `output_token_details`.
3262+
3263+
!!! note "LangSmith SDK"
3264+
The LangSmith SDK also has a `UsageMetadata` class. While the two share fields,
3265+
LangSmith's `UsageMetadata` has additional fields to capture cost information
3266+
used by the LangSmith platform.
32623267
''',
32633268
'properties': dict({
32643269
'input_token_details': dict({
@@ -4728,6 +4733,11 @@
47284733

47294734
!!! warning "Behavior changed in 0.3.9"
47304735
Added `input_token_details` and `output_token_details`.
4736+
4737+
!!! note "LangSmith SDK"
4738+
The LangSmith SDK also has a `UsageMetadata` class. While the two share fields,
4739+
LangSmith's `UsageMetadata` has additional fields to capture cost information
4740+
used by the LangSmith platform.
47314741
''',
47324742
'properties': dict({
47334743
'input_token_details': dict({
@@ -6209,6 +6219,11 @@
62096219

62106220
!!! warning "Behavior changed in 0.3.9"
62116221
Added `input_token_details` and `output_token_details`.
6222+
6223+
!!! note "LangSmith SDK"
6224+
The LangSmith SDK also has a `UsageMetadata` class. While the two share fields,
6225+
LangSmith's `UsageMetadata` has additional fields to capture cost information
6226+
used by the LangSmith platform.
62126227
''',
62136228
'properties': dict({
62146229
'input_token_details': dict({
@@ -7546,6 +7561,11 @@
75467561

75477562
!!! warning "Behavior changed in 0.3.9"
75487563
Added `input_token_details` and `output_token_details`.
7564+
7565+
!!! note "LangSmith SDK"
7566+
The LangSmith SDK also has a `UsageMetadata` class. While the two share fields,
7567+
LangSmith's `UsageMetadata` has additional fields to capture cost information
7568+
used by the LangSmith platform.
75497569
''',
75507570
'properties': dict({
75517571
'input_token_details': dict({
@@ -9057,6 +9077,11 @@
90579077

90589078
!!! warning "Behavior changed in 0.3.9"
90599079
Added `input_token_details` and `output_token_details`.
9080+
9081+
!!! note "LangSmith SDK"
9082+
The LangSmith SDK also has a `UsageMetadata` class. While the two share fields,
9083+
LangSmith's `UsageMetadata` has additional fields to capture cost information
9084+
used by the LangSmith platform.
90609085
''',
90619086
'properties': dict({
90629087
'input_token_details': dict({
@@ -10439,6 +10464,11 @@
1043910464

1044010465
!!! warning "Behavior changed in 0.3.9"
1044110466
Added `input_token_details` and `output_token_details`.
10467+
10468+
!!! note "LangSmith SDK"
10469+
The LangSmith SDK also has a `UsageMetadata` class. While the two share fields,
10470+
LangSmith's `UsageMetadata` has additional fields to capture cost information
10471+
used by the LangSmith platform.
1044210472
''',
1044310473
'properties': dict({
1044410474
'input_token_details': dict({
@@ -11869,6 +11899,11 @@
1186911899

1187011900
!!! warning "Behavior changed in 0.3.9"
1187111901
Added `input_token_details` and `output_token_details`.
11902+
11903+
!!! note "LangSmith SDK"
11904+
The LangSmith SDK also has a `UsageMetadata` class. While the two share fields,
11905+
LangSmith's `UsageMetadata` has additional fields to capture cost information
11906+
used by the LangSmith platform.
1187211907
''',
1187311908
'properties': dict({
1187411909
'input_token_details': dict({
@@ -13300,6 +13335,11 @@
1330013335

1330113336
!!! warning "Behavior changed in 0.3.9"
1330213337
Added `input_token_details` and `output_token_details`.
13338+
13339+
!!! note "LangSmith SDK"
13340+
The LangSmith SDK also has a `UsageMetadata` class. While the two share fields,
13341+
LangSmith's `UsageMetadata` has additional fields to capture cost information
13342+
used by the LangSmith platform.
1330313343
''',
1330413344
'properties': dict({
1330513345
'input_token_details': dict({

libs/langchain/langchain_classic/agents/agent_toolkits/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
permissions of the tools that underlie the given agent toolkit, and determine
1212
whether permissions of the given toolkit are appropriate for the application.
1313
14-
See [Security](https://python.langchain.com/docs/security) for more information.
14+
See [Security](https://docs.langchain.com/oss/python/security-policy) for more
15+
information.
1516
"""
1617

1718
from pathlib import Path

libs/langchain/langchain_classic/chains/api/base.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ def _check_in_allowed_domain(url: str, limit_to_domains: Sequence[str]) -> bool:
6868
class APIChain(Chain):
6969
"""Chain that makes API calls and summarizes the responses to answer a question.
7070
71-
*Security Note*: This API chain uses the requests toolkit
72-
to make GET, POST, PATCH, PUT, and DELETE requests to an API.
71+
**Security Note**: This API chain uses the requests toolkit
72+
to make `GET`, `POST`, `PATCH`, `PUT`, and `DELETE` requests to an API.
7373
7474
Exercise care in who is allowed to use this chain. If exposing
7575
to end users, consider that users will be able to make arbitrary
@@ -80,7 +80,8 @@ class APIChain(Chain):
8080
Control access to who can submit issue requests using this toolkit and
8181
what network access it has.
8282
83-
See https://python.langchain.com/docs/security for more information.
83+
See https://docs.langchain.com/oss/python/security-policy for more
84+
information.
8485
8586
!!! note
8687
This class is deprecated. See below for a replacement implementation using
@@ -90,7 +91,7 @@ class APIChain(Chain):
9091
- Support for both token-by-token and step-by-step streaming;
9192
- Support for checkpointing and memory of chat history;
9293
- Easier to modify or extend
93-
(e.g., with additional tools, structured responses, etc.)
94+
(e.g., with additional tools, structured responses, etc.)
9495
9596
Install LangGraph with:
9697
@@ -206,7 +207,6 @@ async def acall_model(state: ChainState, config: RunnableConfig):
206207
207208
* For example, to limit to just the domain `https://www.example.com`, set
208209
`limit_to_domains=["https://www.example.com"]`.
209-
210210
* The default value is an empty tuple, which means that no domains are
211211
allowed by default. By design this will raise an error on instantiation.
212212
* Use a None if you want to allow all domains by default -- this is not

0 commit comments

Comments
 (0)