Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/chat deployment #40

Merged
merged 85 commits into from
Jan 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
85 commits
Select commit Hold shift + click to select a range
f6166e9
Rename auth method in docs
FilipZmijewski Jan 15, 2025
7e395cb
fix(core): Fix trim messages mutation bug (#7547)
jacoblee93 Jan 18, 2025
a52fde3
release(core): 0.3.31 (#7548)
jacoblee93 Jan 18, 2025
74c06a5
fix(community): Updated Embeddings URL (#7545)
Jacky3003 Jan 18, 2025
9804d8f
fix(community): make sure guardrailConfig can be added even with anth…
madmed88 Jan 18, 2025
904dcad
docs: Fix PGVectorStore import in install dependencies (TypeScript) e…
bploetz Jan 18, 2025
e0e2fc9
fix(community): Airtable url (#7532)
eduardconstantin Jan 18, 2025
9314ef1
docs: Fix typo in OpenAIModerationChain example (#7528)
JonathanVelkeneers Jan 18, 2025
e1c8212
docs: Resolves #7483, resolves #7274 (#7505)
ucev Jan 18, 2025
08f1a46
docs: Rename auth method in IBM docs (#7524)
FilipZmijewski Jan 18, 2025
900381a
docs: correct misspelling (#7522)
ucev Jan 18, 2025
f1dbe28
release(community): 0.3.25 (#7549)
jacoblee93 Jan 18, 2025
3a1131a
feat(azure-cosmosdb): add session context for a user mongodb (#7436)
crisjy Jan 18, 2025
9518c50
release(azure-cosmosdb): 0.2.7 (#7550)
jacoblee93 Jan 18, 2025
1546a2e
fix(ci): Fix build (#7551)
jacoblee93 Jan 18, 2025
94467fa
feat(anthropic): Add Anthropic PDF support (document type) in invoke …
adhambadr Jan 18, 2025
fca3d89
release(anthropic): 0.3.12 (#7552)
jacoblee93 Jan 18, 2025
b235062
chore(core,langchain,community): Relax langsmith deps (#7556)
jacoblee93 Jan 20, 2025
64c2b8f
release(community): 0.3.26 (#7557)
jacoblee93 Jan 20, 2025
bb33dca
release(core): 0.3.32 (#7558)
jacoblee93 Jan 20, 2025
c4f6122
Release 0.3.12 (#7559)
jacoblee93 Jan 20, 2025
828f5e6
Merge branch 'main' of https://github.com/FilipZmijewski/langchainjs
FilipZmijewski Jan 21, 2025
362f321
Merge branch 'main' of https://github.com/langchain-ai/langchainjs
FilipZmijewski Jan 21, 2025
b6007bb
fix(core): Prevent cache misses from triggering model start callback …
jacoblee93 Jan 21, 2025
e0fc2a4
fix(core): Ensure that cached flag in run extras is only set for cach…
jacoblee93 Jan 21, 2025
54ef101
release(core): 0.3.33 (#7567)
jacoblee93 Jan 21, 2025
29ad109
feat(community): Adds graph_document to export list (#7555)
hlminh2000 Jan 22, 2025
fe37032
fix(langchain): Fix ZeroShotAgent createPrompt with correct formatted…
thu2004 Jan 22, 2025
a9298a6
docs: Add document for AzureCosmosDBMongoChatMessageHistory (#7519)
fatmelon Jan 22, 2025
2961898
fix(langchain): Allow pulling hub prompts with associated models (#7569)
jacoblee93 Jan 22, 2025
a2ebf76
fix(community,aws): Update handleLLMNewToken to include chunk metadat…
mohebifar Jan 22, 2025
0397e93
feat(community): Provide fallback relationshipType in case it is not …
hlminh2000 Jan 22, 2025
5bdbb75
docs: Add redirect (#7570)
jacoblee93 Jan 22, 2025
71dd696
fix(langchain,core): Add shim for hub mustache templates with nested …
jacoblee93 Jan 24, 2025
765b057
fix(chat-models): honor disableStreaming even for `generateUncached` …
dqbd Jan 24, 2025
3671e26
release(core): 0.3.34 (#7584)
bracesproul Jan 24, 2025
88c75e9
feat(langchain): Add hub entrypoint with automatic dynamic entrypoint…
jacoblee93 Jan 25, 2025
86fa0d5
chore(ollama): Export `OllamaEmbeddingsParams` interface (#7574)
gurisko Jan 25, 2025
7326a63
docs: Clarify tool creation process in structured outputs documentati…
saharis9988 Jan 25, 2025
a71067d
fix(community): Set awaitHandlers to true in upstash ratelimit (#7571)
CahidArda Jan 25, 2025
93862f4
fix(core): Fix trim messages mutation (#7585)
jacoblee93 Jan 25, 2025
90b06fa
feat(openai): Make only AzureOpenAI respect Azure env vars, remove cl…
jacoblee93 Jan 25, 2025
4a44ca3
fix(community): Make postgresConnectionOptions optional in PostgresRe…
JonathanVelkeneers Jan 25, 2025
259bf7a
release(community): 0.3.27 (#7586)
jacoblee93 Jan 25, 2025
5693683
release(ollama): 0.1.5 (#7587)
jacoblee93 Jan 25, 2025
264c300
Release 0.3.13 (#7588)
jacoblee93 Jan 25, 2025
e325f4c
release(openai): 0.4.0 (#7589)
jacoblee93 Jan 25, 2025
3419ade
release(core): 0.3.35 (#7590)
jacoblee93 Jan 25, 2025
1cb4e29
fix(ci): Update lock (#7591)
jacoblee93 Jan 25, 2025
0bc8130
feat(core): Allow passing returnDirect in tool wrapper params (#7594)
jacoblee93 Jan 25, 2025
0eae6d9
release(core): 0.3.36 (#7595)
jacoblee93 Jan 25, 2025
0ecaad1
fix(openai): Revert Azure default withStructuredOutput changes (#7596)
jacoblee93 Jan 25, 2025
67ca4f9
release(openai): 0.4.1 (#7597)
jacoblee93 Jan 25, 2025
cb335ba
feat(openai): Refactor to allow easier subclassing (#7598)
jacoblee93 Jan 25, 2025
fcdf4bc
release(openai): 0.4.2 (#7599)
jacoblee93 Jan 25, 2025
b648814
feat(deepseek): Adds Deepseek integration (#7604)
jacoblee93 Jan 28, 2025
f926ede
release(deepseek): 0.0.1 (#7608)
jacoblee93 Jan 28, 2025
74f89e6
feat: update Novita AI doc (#7602)
jasonhp Jan 28, 2025
797c0ee
Add deployment chat to chat class
FilipZmijewski Jan 28, 2025
184b34b
feat(langchain): Add DeepSeek to initChatModel (#7609)
jacoblee93 Jan 28, 2025
bdab4a3
Release 0.3.14 (#7611)
jacoblee93 Jan 28, 2025
29486ed
fix: Add test for pdf uploads anthropic (#7613)
bracesproul Jan 28, 2025
8cf9f45
feat: Update google genai to support file uploads (#7612)
bracesproul Jan 28, 2025
f0feee4
chore(google-genai): Drop .only in test (#7614)
bracesproul Jan 28, 2025
c1cda51
release(google-genai): 0.1.7 (#7615)
bracesproul Jan 28, 2025
ba8f272
Upadate Watsonx sdk
FilipZmijewski Jan 29, 2025
535c9d5
fix(core): Fix stream events bug when errors are thrown too quickly d…
jacoblee93 Jan 29, 2025
a4404fb
release(core): 0.3.37 (#7619)
jacoblee93 Jan 29, 2025
3c53dcd
fix(langchain): Fix Groq import for hub (#7620)
jacoblee93 Jan 29, 2025
b70a84e
docs: update README/intro
vbarda Jan 29, 2025
8f7e70a
docs: update README/intro (#7625)
vbarda Jan 29, 2025
0e37db8
Release 0.3.15
jacoblee93 Jan 29, 2025
7cf310a
Release 0.3.15 (#7626)
jacoblee93 Jan 29, 2025
b4d924f
feat(community): improve support for Tavily search tool args (#7561)
hugoleborso Jan 30, 2025
ad4d0c9
feat(community): Add boolean metadata type support in Supabase struct…
ArmmGh Jan 30, 2025
5f2b7b0
feat(google-genai): Add support for fileUri in media type in Google G…
hongkongkiwi Jan 30, 2025
0e48a75
release(google-genai): 0.1.8 (#7628)
jacoblee93 Jan 30, 2025
05eedae
release(community): 0.3.28 (#7629)
jacoblee93 Jan 30, 2025
bf47045
Rework interfaces in llms as well
FilipZmijewski Jan 30, 2025
02fa92c
Bump watsonx-ai sdk version
FilipZmijewski Jan 30, 2025
ca04f75
Remove unused code
FilipZmijewski Jan 30, 2025
c4681e5
Add fake auth
FilipZmijewski Jan 30, 2025
d934705
Merge remote-tracking branch 'upstream/main' into feature/chat-deploy…
FilipZmijewski Jan 30, 2025
31aabe7
Merge branch 'main' into feature/chat-deployment
FilipZmijewski Jan 30, 2025
52cfa62
Fix broken changes
FilipZmijewski Jan 30, 2025
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 README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ The LangChain libraries themselves are made up of several different packages.
- **[`@langchain/core`](https://github.com/langchain-ai/langchainjs/blob/main/langchain-core)**: Base abstractions and LangChain Expression Language.
- **[`@langchain/community`](https://github.com/langchain-ai/langchainjs/blob/main/libs/langchain-community)**: Third party integrations.
- **[`langchain`](https://github.com/langchain-ai/langchainjs/blob/main/langchain)**: Chains, agents, and retrieval strategies that make up an application's cognitive architecture.
- **[LangGraph.js](https://langchain-ai.github.io/langgraphjs/)**: A library for building robust and stateful multi-actor applications with LLMs by modeling steps as edges and nodes in a graph. Integrates smoothly with LangChain, but can be used without it.
- **[LangGraph.js](https://langchain-ai.github.io/langgraphjs/)**: LangGraph powers production-grade agents, trusted by Linkedin, Uber, Klarna, GitLab, and many more. Build robust and stateful multi-actor applications with LLMs by modeling steps as edges and nodes in a graph. Integrates smoothly with LangChain, but can be used without it.

Integrations may also be split into their own compatible packages.

Expand Down
12 changes: 9 additions & 3 deletions docs/core_docs/docs/concepts/structured_outputs.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ Several more powerful methods that utilizes native features in the model provide

Many [model providers support](/docs/integrations/chat/) tool calling, a concept discussed in more detail in our [tool calling guide](/docs/concepts/tool_calling/).
In short, tool calling involves binding a tool to a model and, when appropriate, the model can _decide_ to call this tool and ensure its response conforms to the tool's schema.
With this in mind, the central concept is straightforward: _simply bind our schema to a model as a tool!_
With this in mind, the central concept is straightforward: _create a tool with our schema and bind it to the model!_
Here is an example using the `ResponseFormatter` schema defined above:

```typescript
Expand All @@ -90,8 +90,14 @@ const model = new ChatOpenAI({
temperature: 0,
});

// Bind ResponseFormatter schema as a tool to the model
const modelWithTools = model.bindTools([ResponseFormatter]);
// Create a tool with ResponseFormatter as its schema.
const responseFormatterTool = tool(async () => {}, {
name: "responseFormatter",
schema: ResponseFormatter,
});

// Bind the created tool to the model
const modelWithTools = model.bindTools([responseFormatterTool]);

// Invoke the model
const aiMsg = await modelWithTools.invoke(
Expand Down
2 changes: 1 addition & 1 deletion docs/core_docs/docs/how_to/graph_constructing.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
"\n",
"const model = new ChatOpenAI({\n",
" temperature: 0,\n",
" model: \"gpt-4-turbo-preview\",\n",
" model: \"gpt-4o-mini\",\n",
"});\n",
"\n",
"const llmGraphTransformer = new LLMGraphTransformer({\n",
Expand Down
4 changes: 2 additions & 2 deletions docs/core_docs/docs/how_to/query_high_cardinality.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@
"metadata": {},
"source": [
"```{=mdx}\n",
"<ChatModelTabs customVarName=\"llmLong\" openaiParams={`{ model: \"gpt-4-turbo-preview\" }`} />\n",
"<ChatModelTabs customVarName=\"llmLong\" openaiParams={`{ model: \"gpt-4o-mini\" }`} />\n",
"```"
]
},
Expand Down Expand Up @@ -635,4 +635,4 @@
},
"nbformat": 4,
"nbformat_minor": 5
}
}
312 changes: 312 additions & 0 deletions docs/core_docs/docs/integrations/chat/deepseek.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,312 @@
{
"cells": [
{
"cell_type": "raw",
"id": "afaf8039",
"metadata": {
"vscode": {
"languageId": "raw"
}
},
"source": [
"---\n",
"sidebar_label: DeepSeek\n",
"---"
]
},
{
"cell_type": "markdown",
"id": "e49f1e0d",
"metadata": {},
"source": [
"# ChatDeepSeek\n",
"\n",
"This will help you getting started with DeepSeek [chat models](/docs/concepts/#chat-models). For detailed documentation of all `ChatDeepSeek` features and configurations head to the [API reference](https://api.js.langchain.com/classes/_langchain_deepseek.ChatDeepSeek.html).\n",
"\n",
"## Overview\n",
"### Integration details\n",
"\n",
"| Class | Package | Local | Serializable | [PY support](https://python.langchain.com/docs/integrations/chat/deepseek) | Package downloads | Package latest |\n",
"| :--- | :--- | :---: | :---: | :---: | :---: | :---: |\n",
"| [`ChatDeepSeek`](https://api.js.langchain.com/classes/_langchain_deepseek.ChatDeepSeek.html) | [`@langchain/deepseek`](https://npmjs.com/@langchain/deepseek) | ❌ (see [Ollama](/docs/integrations/chat/ollama)) | beta | ✅ | ![NPM - Downloads](https://img.shields.io/npm/dm/@langchain/deepseek?style=flat-square&label=%20&) | ![NPM - Version](https://img.shields.io/npm/v/@langchain/deepseek?style=flat-square&label=%20&) |\n",
"\n",
"### Model features\n",
"\n",
"See the links in the table headers below for guides on how to use specific features.\n",
"\n",
"| [Tool calling](/docs/how_to/tool_calling) | [Structured output](/docs/how_to/structured_output/) | JSON mode | [Image input](/docs/how_to/multimodal_inputs/) | Audio input | Video input | [Token-level streaming](/docs/how_to/chat_streaming/) | [Token usage](/docs/how_to/chat_token_usage_tracking/) | [Logprobs](/docs/how_to/logprobs/) |\n",
"| :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: |\n",
"| ✅ | ✅ | ✅ | ❌ | ❌ | ❌ | ✅ | ✅ | ✅ | \n",
"\n",
"Note that as of 1/27/25, tool calling and structured output are not currently supported for `deepseek-reasoner`.\n",
"\n",
"## Setup\n",
"\n",
"To access DeepSeek models you'll need to create a DeepSeek account, get an API key, and install the `@langchain/deepseek` integration package.\n",
"\n",
"You can also access the DeepSeek API through providers like [Together AI](/docs/integrations/chat/togetherai) or [Ollama](/docs/integrations/chat/ollama).\n",
"\n",
"### Credentials\n",
"\n",
"Head to https://deepseek.com/ to sign up to DeepSeek and generate an API key. Once you've done this set the `DEEPSEEK_API_KEY` environment variable:\n",
"\n",
"```bash\n",
"export DEEPSEEK_API_KEY=\"your-api-key\"\n",
"```\n",
"\n",
"If you want to get automated tracing of your model calls you can also set your [LangSmith](https://docs.smith.langchain.com/) API key by uncommenting below:\n",
"\n",
"```bash\n",
"# export LANGSMITH_TRACING=\"true\"\n",
"# export LANGSMITH_API_KEY=\"your-api-key\"\n",
"```\n",
"\n",
"### Installation\n",
"\n",
"The LangChain ChatDeepSeek integration lives in the `@langchain/deepseek` package:\n",
"\n",
"```{=mdx}\n",
"import IntegrationInstallTooltip from \"@mdx_components/integration_install_tooltip.mdx\";\n",
"import Npm2Yarn from \"@theme/Npm2Yarn\";\n",
"\n",
"<IntegrationInstallTooltip></IntegrationInstallTooltip>\n",
"\n",
"<Npm2Yarn>\n",
" @langchain/deepseek @langchain/core\n",
"</Npm2Yarn>\n",
"\n",
"```"
]
},
{
"cell_type": "markdown",
"id": "a38cde65-254d-4219-a441-068766c0d4b5",
"metadata": {},
"source": [
"## Instantiation\n",
"\n",
"Now we can instantiate our model object and generate chat completions:"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "cb09c344-1836-4e0c-acf8-11d13ac1dbae",
"metadata": {},
"outputs": [],
"source": [
"import { ChatDeepSeek } from \"@langchain/deepseek\";\n",
"\n",
"const llm = new ChatDeepSeek({\n",
" model: \"deepseek-reasoner\",\n",
" temperature: 0,\n",
" // other params...\n",
"})"
]
},
{
"cell_type": "markdown",
"id": "2b4f3e15",
"metadata": {},
"source": [
"<!-- ## Invocation -->"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "62e0dbc3",
"metadata": {
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"AIMessage {\n",
" \"id\": \"e2874482-68a7-4552-8154-b6a245bab429\",\n",
" \"content\": \"J'adore la programmation.\",\n",
" \"additional_kwargs\": {,\n",
" \"reasoning_content\": \"...\",\n",
" },\n",
" \"response_metadata\": {\n",
" \"tokenUsage\": {\n",
" \"promptTokens\": 23,\n",
" \"completionTokens\": 7,\n",
" \"totalTokens\": 30\n",
" },\n",
" \"finish_reason\": \"stop\",\n",
" \"model_name\": \"deepseek-reasoner\",\n",
" \"usage\": {\n",
" \"prompt_tokens\": 23,\n",
" \"completion_tokens\": 7,\n",
" \"total_tokens\": 30,\n",
" \"prompt_tokens_details\": {\n",
" \"cached_tokens\": 0\n",
" },\n",
" \"prompt_cache_hit_tokens\": 0,\n",
" \"prompt_cache_miss_tokens\": 23\n",
" },\n",
" \"system_fingerprint\": \"fp_3a5770e1b4\"\n",
" },\n",
" \"tool_calls\": [],\n",
" \"invalid_tool_calls\": [],\n",
" \"usage_metadata\": {\n",
" \"output_tokens\": 7,\n",
" \"input_tokens\": 23,\n",
" \"total_tokens\": 30,\n",
" \"input_token_details\": {\n",
" \"cache_read\": 0\n",
" },\n",
" \"output_token_details\": {}\n",
" }\n",
"}\n"
]
}
],
"source": [
"const aiMsg = await llm.invoke([\n",
" [\n",
" \"system\",\n",
" \"You are a helpful assistant that translates English to French. Translate the user sentence.\",\n",
" ],\n",
" [\"human\", \"I love programming.\"],\n",
"])\n",
"aiMsg"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "d86145b3-bfef-46e8-b227-4dda5c9c2705",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"J'adore la programmation.\n"
]
}
],
"source": [
"console.log(aiMsg.content)"
]
},
{
"cell_type": "markdown",
"id": "18e2bfc0-7e78-4528-a73f-499ac150dca8",
"metadata": {},
"source": [
"## Chaining\n",
"\n",
"We can [chain](/docs/how_to/sequence/) our model with a prompt template like so:"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "e197d1d7-a070-4c96-9f8a-a0e86d046e0b",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"AIMessage {\n",
" \"id\": \"6e7f6f8c-8d7a-4dad-be07-425384038fd4\",\n",
" \"content\": \"Ich liebe es zu programmieren.\",\n",
" \"additional_kwargs\": {,\n",
" \"reasoning_content\": \"...\",\n",
" },\n",
" \"response_metadata\": {\n",
" \"tokenUsage\": {\n",
" \"promptTokens\": 18,\n",
" \"completionTokens\": 9,\n",
" \"totalTokens\": 27\n",
" },\n",
" \"finish_reason\": \"stop\",\n",
" \"model_name\": \"deepseek-reasoner\",\n",
" \"usage\": {\n",
" \"prompt_tokens\": 18,\n",
" \"completion_tokens\": 9,\n",
" \"total_tokens\": 27,\n",
" \"prompt_tokens_details\": {\n",
" \"cached_tokens\": 0\n",
" },\n",
" \"prompt_cache_hit_tokens\": 0,\n",
" \"prompt_cache_miss_tokens\": 18\n",
" },\n",
" \"system_fingerprint\": \"fp_3a5770e1b4\"\n",
" },\n",
" \"tool_calls\": [],\n",
" \"invalid_tool_calls\": [],\n",
" \"usage_metadata\": {\n",
" \"output_tokens\": 9,\n",
" \"input_tokens\": 18,\n",
" \"total_tokens\": 27,\n",
" \"input_token_details\": {\n",
" \"cache_read\": 0\n",
" },\n",
" \"output_token_details\": {}\n",
" }\n",
"}\n"
]
}
],
"source": [
"import { ChatPromptTemplate } from \"@langchain/core/prompts\"\n",
"\n",
"const prompt = ChatPromptTemplate.fromMessages(\n",
" [\n",
" [\n",
" \"system\",\n",
" \"You are a helpful assistant that translates {input_language} to {output_language}.\",\n",
" ],\n",
" [\"human\", \"{input}\"],\n",
" ]\n",
")\n",
"\n",
"const chain = prompt.pipe(llm);\n",
"await chain.invoke(\n",
" {\n",
" input_language: \"English\",\n",
" output_language: \"German\",\n",
" input: \"I love programming.\",\n",
" }\n",
")"
]
},
{
"cell_type": "markdown",
"id": "3a5bb5ca-c3ae-4a58-be67-2cd18574b9a3",
"metadata": {},
"source": [
"## API reference\n",
"\n",
"For detailed documentation of all ChatDeepSeek features and configurations head to the API reference: https://api.js.langchain.com/classes/_langchain_deepseek.ChatDeepSeek.html"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "TypeScript",
"language": "typescript",
"name": "tslab"
},
"language_info": {
"codemirror_mode": {
"mode": "typescript",
"name": "javascript",
"typescript": true
},
"file_extension": ".ts",
"mimetype": "text/typescript",
"name": "typescript",
"version": "3.7.2"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Loading
Loading