-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
core[patch]: Allow runnable tools to take single string/ToolCall
inputs
#6096
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
527ddec
core[patch]: Allow runnable tools to take single string inputs
bracesproul 22ad932
add test for tool func
bracesproul 64dc64b
chore: lint files
bracesproul 8c906ae
cr
bracesproul bbb27f8
cr
bracesproul be01959
cr
bracesproul 8f52514
fix types
bracesproul 79e69ee
rename ZodAny to ZodObjectAny
bracesproul fb7d240
docstring nits
bracesproul 3ef9ac1
fiox
bracesproul e068df4
Merge branch 'main' into brace/allow-single-string-tools
bracesproul f233db6
cr
bracesproul a545f9a
cr
bracesproul 49e51e3
Merge branch 'main' into brace/allow-single-string-tools
bracesproul File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { ToolCall } from "../messages/tool.js"; | ||
|
||
export function _isToolCall(toolCall?: unknown): toolCall is ToolCall { | ||
return !!( | ||
toolCall && | ||
typeof toolCall === "object" && | ||
"type" in toolCall && | ||
toolCall.type === "tool_call" | ||
); | ||
} | ||
|
||
/** | ||
* Custom error class used to handle exceptions related to tool input parsing. | ||
* It extends the built-in `Error` class and adds an optional `output` | ||
* property that can hold the output that caused the exception. | ||
*/ | ||
export class ToolInputParsingException extends Error { | ||
output?: string; | ||
|
||
constructor(message: string, output?: string) { | ||
super(message); | ||
this.output = output; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import type { z } from "zod"; | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
export type ZodAny = z.ZodObject<any, any, any, any>; | ||
export type ZodObjectAny = z.ZodObject<any, any, any, any>; | ||
bracesproul marked this conversation as resolved.
Show resolved
Hide resolved
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey there! 👋 I noticed that this PR adds a new peer dependency for "@langchain/langgraph". This comment is just to flag this change for the maintainers to review. Keep up the great work! 🚀