Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/oss/contributing/code.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ Set up a development environment for the package(s) you're working on:
:::js
Located in `libs/providers/`, these are independently versioned packages for specific integrations. For example:
- **[`@langchain/openai`](https://github.com/langchain-ai/langchainjs/tree/main/libs/langchain-openai#readme)**: [OpenAI](/oss/integrations/providers/openai) integrations
- **[`@langchain/anthropic`](https://github.com/langchain-ai/langchainjs/tree/main/libs/langchain-anthropic#readme)**: [Anthropic](oss/javascript/integrations/providers/anthropic) integrations
- **[`@langchain/anthropic`](https://github.com/langchain-ai/langchainjs/tree/main/libs/langchain-anthropic#readme)**: [Anthropic](/oss/integrations/providers/anthropic) integrations
- **[`@langchain/google-genai`](https://github.com/langchain-ai/langchainjs/tree/main/libs/langchain-google-genai#readme)**: [Google Generative AI](/oss/integrations/chat/google_generative_ai) integrations
:::

Expand Down
2 changes: 1 addition & 1 deletion src/oss/javascript/integrations/chat/anthropic.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -990,7 +990,7 @@ Learn more about tool calling [here](https://js.langchain.com/docs/how_to/tool_c

### Using with text splitters

Anthropic also lets you specify your own splits using [custom document](https://docs.anthropic.com/en/docs/build-with-claude/citations#custom-content-documents) types. LangChain [text splitters](/oss/concepts/text_splitters/) can be used to generate meaningful splits for this purpose. See the below example, where we split the LangChain.js README (a markdown document) and pass it to Claude as context:
Anthropic also lets you specify your own splits using [custom document](https://docs.anthropic.com/en/docs/build-with-claude/citations#custom-content-documents) types. LangChain text splitters can be used to generate meaningful splits for this purpose. See the below example, where we split the LangChain.js README (a markdown document) and pass it to Claude as context:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we dont have it for js


```typescript
import { ChatAnthropic } from "@langchain/anthropic";
Expand Down
10 changes: 1 addition & 9 deletions src/oss/javascript/integrations/chat/openai.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -335,15 +335,7 @@ console.dir(responseMessageWithLogprobs.response_metadata.logprobs, { depth: nul
}
```

## Tool calling

Tool calling with OpenAI models works in a similar to [other models](/oss/langchain/tools). Additionally, the following guides have some information especially relevant to OpenAI:

- [How to: disable parallel tool calling](/oss/langchain/tools_parallel/)
- [How to: force a tool call](/oss/how-to/tool_choice/)
- [How to: bind model-specific tool formats to a model](/oss/langchain/tools#binding-model-specific-formats-advanced).

### Custom Tools
## Custom Tools

[Custom tools](https://platform.openai.com/docs/guides/function-calling#custom-tools) support tools with arbitrary string inputs. They can be particularly useful when you expect your string arguments to be long or complex.

Expand Down
2 changes: 1 addition & 1 deletion src/oss/javascript/integrations/llm_caching/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: Model caches
---

[Caching LLM calls](/oss/how-to/chat_model_caching) can be useful for testing, cost savings, and speed.
[Caching LLM calls](/oss/langchain/models#caching) can be useful for testing, cost savings, and speed.

Below are some integrations that allow you to cache results of individual LLM calls using different caches with different strategies.

Expand Down
2 changes: 1 addition & 1 deletion src/oss/javascript/integrations/llms/azure.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ title: Azure OpenAI
```{=mdx}

<Warning>
**You are currently on a page documenting the use of Azure OpenAI [text completion models](/oss/concepts/text_llms). The latest and most popular Azure OpenAI models are [chat completion models](/oss/langchain/models).**
**You are currently on a page documenting the use of Azure OpenAI text completion models. The latest and most popular Azure OpenAI models are [chat completion models](/oss/langchain/models).**


Unless you are specifically using `gpt-3.5-turbo-instruct`, you are probably looking for [this page instead](/oss/integrations/chat/azure/).
Expand Down
2 changes: 1 addition & 1 deletion src/oss/javascript/integrations/llms/bedrock.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ title: Bedrock
```{=mdx}

<Warning>
**You are currently on a page documenting the use of Amazon Bedrock models as [text completion models](/oss/concepts/text_llms). Many popular models available on Bedrock are [chat completion models](/oss/langchain/models).**
**You are currently on a page documenting the use of Amazon Bedrock models as text completion models. Many popular models available on Bedrock are [chat completion models](/oss/langchain/models).**


You may be looking for [this page instead](/oss/integrations/chat/bedrock/).
Expand Down
2 changes: 1 addition & 1 deletion src/oss/javascript/integrations/llms/cohere.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Cohere has marked their `generate` endpoint for LLMs as deprecated. Follow their
</Warning>

<Warning>
**You are currently on a page documenting the use of Cohere models as [text completion models](/oss/concepts/text_llms). Many popular models available on Cohere are [chat completion models](/oss/langchain/models).**
**You are currently on a page documenting the use of Cohere models as text completion models. Many popular models available on Cohere are [chat completion models](/oss/langchain/models).**

You may be looking for [this page instead](/oss/integrations/chat/cohere/).
</Warning>
Expand Down
2 changes: 1 addition & 1 deletion src/oss/javascript/integrations/llms/fireworks.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ title: Fireworks
```{=mdx}

<Warning>
**You are currently on a page documenting the use of Fireworks models as [text completion models](/oss/concepts/text_llms). Many popular models available on Fireworks are [chat completion models](/oss/langchain/models).**
**You are currently on a page documenting the use of Fireworks models as text completion models. Many popular models available on Fireworks are [chat completion models](/oss/langchain/models).**


You may be looking for [this page instead](/oss/integrations/chat/fireworks/).
Expand Down
2 changes: 1 addition & 1 deletion src/oss/javascript/integrations/llms/google_vertex_ai.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ title: Google Vertex AI
```{=mdx}

<Warning>
**You are currently on a page documenting the use of Google Vertex models as [text completion models](/oss/concepts/text_llms). Many popular models available on Google Vertex are [chat completion models](/oss/langchain/models).**
**You are currently on a page documenting the use of Google Vertex models as text completion models. Many popular models available on Google Vertex are [chat completion models](/oss/langchain/models).**


You may be looking for [this page instead](/oss/integrations/chat/google_vertex_ai/).
Expand Down
2 changes: 1 addition & 1 deletion src/oss/javascript/integrations/llms/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: LLMs
---

<Warning>
**You are currently on a page documenting the use of [text completion models](/oss/concepts/text_llms). Many of the latest and most popular models are [chat completion models](/oss/langchain/models).**
**You are currently on a page documenting the use of text completion models. Many of the latest and most popular models are [chat completion models](/oss/langchain/models).**


Unless you are specifically using more advanced prompting techniques, you are probably looking for [this page instead](/oss/integrations/chat/).
Expand Down
2 changes: 1 addition & 1 deletion src/oss/javascript/integrations/llms/mistral.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ title: MistralAI
:::

</Tip>caution
You are currently on a page documenting the use of Mistral models as [text completion models](/oss/concepts/text_llms). Many popular models available on Mistral are [chat completion models](/oss/langchain/models).
You are currently on a page documenting the use of Mistral models as text completion models. Many popular models available on Mistral are [chat completion models](/oss/langchain/models).

You may be looking for [this page instead](/oss/integrations/chat/mistral/).
:::
Expand Down
2 changes: 1 addition & 1 deletion src/oss/javascript/integrations/llms/ollama.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ title: Ollama
```{=mdx}

<Warning>
**You are currently on a page documenting the use of Ollama models as [text completion models](/oss/concepts/text_llms). Many popular models available on Ollama are [chat completion models](/oss/langchain/models).**
**You are currently on a page documenting the use of Ollama models as text completion models. Many popular models available on Ollama are [chat completion models](/oss/langchain/models).**


You may be looking for [this page instead](/oss/integrations/chat/ollama/).
Expand Down
2 changes: 1 addition & 1 deletion src/oss/javascript/integrations/llms/openai.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ title: OpenAI
```{=mdx}

<Warning>
**You are currently on a page documenting the use of OpenAI [text completion models](/oss/concepts/text_llms). The latest and most popular OpenAI models are [chat completion models](/oss/langchain/models).**
**You are currently on a page documenting the use of OpenAI text completion models. The latest and most popular OpenAI models are [chat completion models](/oss/langchain/models).**


Unless you are specifically using `gpt-3.5-turbo-instruct`, you are probably looking for [this page instead](/oss/integrations/chat/openai/).
Expand Down
2 changes: 1 addition & 1 deletion src/oss/javascript/integrations/llms/together.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: TogetherAI
---

<Warning>
**You are currently on a page documenting the use of Together AI models as [text completion models](/oss/concepts/text_llms). Many popular models available on Together AI are [chat completion models](/oss/langchain/models).**
**You are currently on a page documenting the use of Together AI models as text completion models. Many popular models available on Together AI are [chat completion models](/oss/langchain/models).**

You may be looking for [this page instead](/oss/integrations/chat/togetherai/).
</Warning>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,4 @@ import CassandraStorage from "/snippets/javascript-integrations/examples/stores/

## Related

- [Key-value store conceptual guide](/oss/concepts/key_value_stores)
- [Key-value store conceptual guide](/oss/integrations/stores)
2 changes: 1 addition & 1 deletion src/oss/javascript/integrations/stores/file_system.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Only available on Node.js.

```

This will help you get started with [LocalFileStore](/oss/concepts/key_value_stores). For detailed documentation of all LocalFileStore features and configurations head to the [API reference](https://api.js.langchain.com/classes/langchain.storage_file_system.LocalFileStore.html).
This will help you get started with [LocalFileStore](/oss/integrations/stores). For detailed documentation of all LocalFileStore features and configurations head to the [API reference](https://api.js.langchain.com/classes/langchain.storage_file_system.LocalFileStore.html).

## Overview

Expand Down
2 changes: 1 addition & 1 deletion src/oss/javascript/integrations/stores/in_memory.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: InMemoryStore
---

This will help you get started with [InMemoryStore](/oss/concepts/key_value_stores). For detailed documentation of all InMemoryStore features and configurations head to the [API reference](https://api.js.langchain.com/classes/langchain_core.stores.InMemoryStore.html).
This will help you get started with [InMemoryStore](/oss/integrations/stores). For detailed documentation of all InMemoryStore features and configurations head to the [API reference](https://api.js.langchain.com/classes/langchain_core.stores.InMemoryStore.html).

The `InMemoryStore` allows for a generic type to be assigned to the values in the store. We'll assign type `BaseMessage` as the type of our values, keeping with the theme of a chat history store.

Expand Down
2 changes: 1 addition & 1 deletion src/oss/javascript/integrations/stores/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: Key-value stores
---

[Key-value stores](/oss/concepts/key_value_stores) are used by other LangChain components to store and retrieve data.
[Key-value stores](/oss/integrations/stores) are used by other LangChain components to store and retrieve data.

## All key-value stores

Expand Down
2 changes: 1 addition & 1 deletion src/oss/javascript/integrations/stores/ioredis_storage.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ import IoredisStorage from "/snippets/javascript-integrations/examples/stores/io

## Related

- [Key-value store conceptual guide](/oss/concepts/key_value_stores)
- [Key-value store conceptual guide](/oss/integrations/stores)
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ import UpstashRedisStorage from "/snippets/javascript-integrations/examples/stor

## Related

- [Key-value store conceptual guide](/oss/concepts/key_value_stores)
- [Key-value store conceptual guide](/oss/integrations/stores)
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ import VercelKvStorage from "/snippets/javascript-integrations/examples/stores/v

## Related

- [Key-value store conceptual guide](/oss/concepts/key_value_stores)
- [Key-value store conceptual guide](/oss/integrations/stores)
2 changes: 1 addition & 1 deletion src/oss/javascript/integrations/tools/connery.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Using this tool, you can integrate individual Connery Action into your LangChain
<Note>
**If you want to use more than one Connery Action in your agent,**

check out the [Connery Toolkit](/oss/integrations/toolkits/connery) documentation.
check out the [Connery Toolkit](/oss/integrations/tools/connery_toolkit) documentation.
</Note>

## What is Connery?
Expand Down
2 changes: 1 addition & 1 deletion src/oss/javascript/integrations/tools/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ title: Tools and Toolkits

[Tools](/oss/langchain/tools) are utilities designed to be called by a model: their inputs are designed to be generated by models, and their outputs are designed to be passed back to models.

A [toolkit](/oss/langchain/tools#toolkits) is a collection of tools meant to be used together. For a list of toolkit integrations, see [this page](/oss/integrations/toolkits/).
A [toolkit](/oss/langchain/tools#toolkits) is a collection of tools meant to be used together.

<Info>
If you'd like to write your own tool, see [this how-to](/oss/langchain/tools#customize-tool-properties). If you'd like to contribute an integration, see [Contributing integrations](/oss/contributing#add-a-new-integration).
Expand Down
2 changes: 0 additions & 2 deletions src/oss/javascript/integrations/tools/mcp_toolbox.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ started](https://googleapis.github.io/genai-toolbox/getting-started/local_quicks
Toolbox, see the
[documentation](https://googleapis.github.io/genai-toolbox/getting-started/introduction/).

![architecture](./assets/mcp_db_toolbox.png)

### Configure and deploy

Toolbox is an open source server that you deploy and manage yourself. For more
Expand Down
12 changes: 6 additions & 6 deletions src/oss/langchain/human-in-the-loop.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import AlphaCallout from '/snippets/alpha-lc-callout.mdx';

<AlphaCallout />

The Human-in-the-Loop (HITL) middleware lets you add human oversight to agent tool calls.
The Human-in-the-Loop (HITL) middleware lets you add human oversight to agent tool calls.
When a model proposes an action that might require review — for example, writing to a file or executing SQL — the middleware can pause execution and wait for a decision.

It does this by checking each tool call against a configurable policy. If intervention is needed, the middleware issues an @[interrupt] that halts execution. The graph state is saved using LangGraph’s [persistence layer](/oss/langgraph/persistence), so execution can pause safely and resume later.
Expand Down Expand Up @@ -40,7 +40,7 @@ You configure it with a mapping of tool actions to the response types that are a

:::python
```python
from langchain.agents import create_agent
from langchain.agents import create_agent
from langchain.agents.middleware import HumanInTheLoopMiddleware # [!code highlight]
from langgraph.checkpoint.memory import InMemorySaver # [!code highlight]

Expand Down Expand Up @@ -109,7 +109,7 @@ const agent = createAgent({
In production, use a persistent checkpointer like @[AsyncPostgresSaver]. For testing or prototyping, use @[InMemorySaver].

When invoking the agent, pass a `config` that includes the **thread ID** to associate execution with a conversation thread.
See the [LangGraph human-in-the-loop documentation](/oss/langgraph/human-in-the-loop) for details.
See the [LangGraph human-in-the-loop documentation](/oss/langgraph/add-human-in-the-loop) for details.
</Info>


Expand Down Expand Up @@ -283,11 +283,11 @@ await agent.invoke(
resume: [
{
type: "edit",
// Tool name to call.
// Tool name to call.
// Will usually be the same as the original action.
action: "new_tool_name",
action: "new_tool_name",
// Arguments to pass to the tool.
args: { key1: "new_value", key2: "original_value" },
args: { key1: "new_value", key2: "original_value" },
}
]
}),
Expand Down
2 changes: 1 addition & 1 deletion src/oss/langgraph/memory.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ Regardless of memory management approach, the central point is that the agent wi
[Episodic memory](https://en.wikipedia.org/wiki/Episodic_memory), in both humans and AI agents, involves recalling past events or actions. The [CoALA paper](https://arxiv.org/pdf/2309.02427) frames this well: facts can be written to semantic memory, whereas *experiences* can be written to episodic memory. For AI agents, episodic memory is often used to help an agent remember how to accomplish a task.

:::python
In practice, episodic memories are often implemented through [few-shot example prompting](https://python.langchain.com/docs/concepts/few_shot_prompting/), where agents learn from past sequences to perform tasks correctly. Sometimes it's easier to "show" than "tell" and LLMs learn well from examples. Few-shot learning lets you ["program"](https://x.com/karpathy/status/1627366413840322562) your LLM by updating the prompt with input-output examples to illustrate the intended behavior. While various [best-practices](https://python.langchain.com/docs/concepts/#1-generating-examples) can be used to generate few-shot examples, often the challenge lies in selecting the most relevant examples based on user input.
In practice, episodic memories are often implemented through [few-shot example prompting](/langsmith/create-few-shot-evaluators), where agents learn from past sequences to perform tasks correctly. Sometimes it's easier to "show" than "tell" and LLMs learn well from examples. Few-shot learning lets you ["program"](https://x.com/karpathy/status/1627366413840322562) your LLM by updating the prompt with input-output examples to illustrate the intended behavior. While various [best-practices](https://python.langchain.com/docs/concepts/#1-generating-examples) can be used to generate few-shot examples, often the challenge lies in selecting the most relevant examples based on user input.
:::

:::js
Expand Down
4 changes: 2 additions & 2 deletions src/oss/python/integrations/chat/anthropic.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ print(json.dumps(response.content_blocks, indent=2))

## Prompt caching

Anthropic supports [caching](https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching) of [elements of your prompts](https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching#what-can-be-cached), including messages, tool definitions, tool results, images and documents. This allows you to re-use large documents, instructions, [few-shot documents](/oss/concepts/few_shot_prompting/), and other data to reduce latency and costs.
Anthropic supports [caching](https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching) of [elements of your prompts](https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching#what-can-be-cached), including messages, tool definitions, tool results, images and documents. This allows you to re-use large documents, instructions, [few-shot documents](/langsmith/create-few-shot-evaluators), and other data to reduce latency and costs.

To enable caching on an element of a prompt, mark its associated content block using the `cache_control` key. See examples below:

Expand Down Expand Up @@ -476,7 +476,7 @@ Prompt caching can be used in [multi-turn conversations](https://docs.anthropic.

We can enable incremental caching by marking the final message with `cache_control`. Claude will automatically use the longest previously-cached prefix for follow-up messages.

Below, we implement a simple chatbot that incorporates this feature. We follow the LangChain [chatbot tutorial](/oss/tutorials/chatbot/), but add a custom [reducer](/oss/langgraph/graph-api#reducers) that automatically marks the last content block in each user message with `cache_control`. See below:
Below, we implement a simple chatbot that incorporates this feature. We follow the LangChain [chatbot tutorial](/oss/langchain/quickstart), but add a custom [reducer](/oss/langgraph/graph-api#reducers) that automatically marks the last content block in each user message with `cache_control`. See below:

```python
import requests
Expand Down
2 changes: 1 addition & 1 deletion src/oss/python/integrations/chat/bedrock.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ ai_msg.content_blocks

## Prompt caching

Bedrock supports [caching](https://docs.aws.amazon.com/bedrock/latest/userguide/prompt-caching.html) of elements of your prompts, including messages and tools. This allows you to re-use large documents, instructions, [few-shot documents](/oss/concepts/few_shot_prompting/), and other data to reduce latency and costs.
Bedrock supports [caching](https://docs.aws.amazon.com/bedrock/latest/userguide/prompt-caching.html) of elements of your prompts, including messages and tools. This allows you to re-use large documents, instructions, [few-shot documents](/langsmith/create-few-shot-evaluators), and other data to reduce latency and costs.

<Note>
**Not all models support prompt caching. See supported models [here](https://docs.aws.amazon.com/bedrock/latest/userguide/prompt-caching.html#prompt-caching-models).**
Expand Down
Loading