-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
experimental[patch]: Improve AutoGPT's output_parser to extract JSON …
…code block (#3656) * Improve output_parser to extract JSON code block Closes #3655 * Ran yarn format and lint
- Loading branch information
Showing
2 changed files
with
23 additions
and
5 deletions.
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
12 changes: 12 additions & 0 deletions
12
langchain/src/experimental/autogpt/tests/output_parser.test.ts
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,12 @@ | ||
import { test, expect } from "@jest/globals"; | ||
import { preprocessJsonInput } from "../output_parser.js"; | ||
|
||
test("should parse outputs correctly", () => { | ||
expect(preprocessJsonInput("{'escaped':'\\a'}")).toBe("{'escaped':'\\\\a'}"); | ||
|
||
expect(preprocessJsonInput("```\n{}\n```")).toBe("{}"); | ||
expect(preprocessJsonInput("```json\n{}\n```")).toBe("{}"); | ||
expect( | ||
preprocessJsonInput("I will do the following:\n\n```json\n{}\n```") | ||
).toBe("{}"); | ||
}); |
3e73fb7
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.
Successfully deployed to the following URLs:
langchainjs-api-refs – ./docs/api_refs
langchainjs-api-refs-langchain.vercel.app
langchainjs-api-docs.vercel.app
api.js.langchain.com
langchainjs-api-refs-git-main-langchain.vercel.app
3e73fb7
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.
Successfully deployed to the following URLs:
langchainjs-docs – ./docs/core_docs/
langchainjs-docs-langchain.vercel.app
langchainjs-docs-git-main-langchain.vercel.app
js.langchain.com
langchainjs-docs-ruddy.vercel.app