Skip to content

Commit

Permalink
Small updates
Browse files Browse the repository at this point in the history
  • Loading branch information
jacoblee93 committed Jun 6, 2024
1 parent 039d0c7 commit 81386fc
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 14 deletions.
5 changes: 1 addition & 4 deletions docs/core_docs/docs/integrations/chat/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ sidebar_class_name: hidden

# Chat models

<!-- This file is autogenerated. Do not edit directly. -->
<!-- See `scripts/model-docs.table.js` for details -->

## Features (natively supported)

All ChatModels implement the Runnable interface, which comes with default implementations of all methods, ie. `invoke`, `batch`, `stream`. This gives all ChatModels basic support for invoking, streaming and batching, which by default is implemented as below:
Expand All @@ -26,7 +23,7 @@ The table shows, for each integration, which features have been implemented with

| Model | Invoke | Stream | Batch | Function Calling | Tool Calling | `withStructuredOutput()` |
| :---------------------- | :----: | :----: | :---: | :--------------: | :----------: | :----------------------: |
| BedrockChat | | | | | 🟡 | |
| BedrockChat ||||| 🟡 (Bedrock Anthropic only) ||
| ChatAlibabaTongyi |||||||
| ChatAnthropic |||||||
| ChatBaiduWenxin |||||||
Expand Down
1 change: 0 additions & 1 deletion libs/langchain-anthropic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
},
"devDependencies": {
"@jest/globals": "^29.5.0",
"@langchain/community": "workspace:*",
"@langchain/scripts": "~0.0.14",
"@langchain/standard-tests": "workspace:*",
"@swc/core": "^1.3.90",
Expand Down
6 changes: 3 additions & 3 deletions libs/langchain-anthropic/src/chat_models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import { ToolCall } from "@langchain/core/messages/tool";
import { z } from "zod";
import {
AnthropicToolsOutputParser,
extractToolCalls,
_extractToolCalls,
} from "./output_parsers.js";
import { AnthropicToolResponse } from "./types.js";

Expand Down Expand Up @@ -123,7 +123,7 @@ function anthropicResponseToChatMessages(
},
];
} else {
const toolCalls = extractToolCalls(messages);
const toolCalls = _extractToolCalls(messages);
const generations: ChatGeneration[] = [
{
text: "",
Expand Down Expand Up @@ -327,7 +327,7 @@ function _formatContent(content: MessageContent) {
* @param messages The base messages to format as a prompt.
* @returns The formatted prompt.
*/
export function formatMessagesForAnthropic(messages: BaseMessage[]): {
export function _formatMessagesForAnthropic(messages: BaseMessage[]): {
system?: string;
messages: AnthropicMessage[];
} {
Expand Down
2 changes: 1 addition & 1 deletion libs/langchain-anthropic/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export * from "./chat_models.js";
export * from "./output_parsers.js";
export { _extractToolCalls } from "./output_parsers.js";
4 changes: 2 additions & 2 deletions libs/langchain-anthropic/src/output_parsers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export class AnthropicToolsOutputParser<
if (!Array.isArray(message.content)) {
return [];
}
const tool = extractToolCalls(message.content)[0];
const tool = _extractToolCalls(message.content)[0];
return tool;
});
if (tools[0] === undefined) {
Expand All @@ -78,7 +78,7 @@ export class AnthropicToolsOutputParser<
}

// eslint-disable-next-line @typescript-eslint/no-explicit-any
export function extractToolCalls(content: Record<string, any>[]) {
export function _extractToolCalls(content: Record<string, any>[]) {
const toolCalls: ToolCall[] = [];
for (const block of content) {
if (block.type === "tool_use") {
Expand Down
2 changes: 1 addition & 1 deletion libs/langchain-community/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@
"author": "LangChain",
"license": "MIT",
"dependencies": {
"@langchain/anthropic": "~0.2.0",
"@langchain/core": "~0.2.0",
"@langchain/openai": "~0.1.0",
"@langchain/anthropic": "~0.2.0",
"binary-extensions": "^2.2.0",
"expr-eval": "^2.0.2",
"flat": "^5.0.2",
Expand Down
4 changes: 2 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8922,13 +8922,12 @@ __metadata:
languageName: node
linkType: hard

"@langchain/anthropic@workspace:*, @langchain/anthropic@workspace:libs/langchain-anthropic":
"@langchain/anthropic@workspace:*, @langchain/anthropic@workspace:libs/langchain-anthropic, @langchain/anthropic@~0.2.0":
version: 0.0.0-use.local
resolution: "@langchain/anthropic@workspace:libs/langchain-anthropic"
dependencies:
"@anthropic-ai/sdk": ^0.21.0
"@jest/globals": ^29.5.0
"@langchain/community": "workspace:*"
"@langchain/core": ">=0.2.5 <0.3.0"
"@langchain/scripts": ~0.0.14
"@langchain/standard-tests": "workspace:*"
Expand Down Expand Up @@ -9098,6 +9097,7 @@ __metadata:
"@gradientai/nodejs-sdk": ^1.2.0
"@huggingface/inference": ^2.6.4
"@jest/globals": ^29.5.0
"@langchain/anthropic": ~0.2.0
"@langchain/core": ~0.2.0
"@langchain/openai": ~0.1.0
"@langchain/scripts": ~0.0.14
Expand Down

0 comments on commit 81386fc

Please sign in to comment.