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

Use Output Parsers for agents #802

Merged
merged 15 commits into from
Apr 17, 2023
Merged

Conversation

joshsny
Copy link
Contributor

@joshsny joshsny commented Apr 14, 2023

refactors agents to use output parsers

@vercel
Copy link

vercel bot commented Apr 14, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
langchainjs-docs ✅ Ready (Inspect) Visit Preview Apr 17, 2023 10:35am

@joshsny joshsny changed the title Agent refactor Use Output Parsers for agents Apr 17, 2023
@joshsny joshsny marked this pull request as ready for review April 17, 2023 09:20
langchain/src/agents/chat/outputParser.ts Outdated Show resolved Hide resolved
@@ -1,10 +1,10 @@
import { BaseLanguageModel } from "../base_language/index.js";
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this import reordering something we can add to CI / pre-commit hook?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You can find an implementation of this that we could add as a pre-commit hook here. Do you want me to follow up with that in another PR?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yea would be nice, but not a massive priority

langchain/src/util/type-utils.ts Outdated Show resolved Hide resolved
langchain/src/util/type-utils.ts Outdated Show resolved Hide resolved
@nfcampos nfcampos added the lgtm PRs that are ready to be merged as-is label Apr 17, 2023
@nfcampos nfcampos merged commit 7a7d3d9 into langchain-ai:main Apr 17, 2023
RohitMidha23 pushed a commit to RohitMidha23/langchainjs that referenced this pull request Apr 18, 2023
* create ChatAgentV2 and add example

* fix intermediate_steps

* remove unnecessary code

* unnecessary logs

* remove chatv2, refactor other agents

* add output parsers to agents

* correct imports

* add callbackManager to fromLLMAndTools

* Update langchain/src/util/type-utils.ts

* fix circular dep

* requested changes

---------

Co-authored-by: Nuno Campos <nuno@boringbits.io>
jsonOutput = jsonOutput.slice(0, -3).trimEnd();
}

const response = JSON.parse(jsonOutput);
Copy link
Contributor

Choose a reason for hiding this comment

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

Parser error handling (see i.e. langchain/src/agents/chat/outputParser.ts) is missing now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm PRs that are ready to be merged as-is
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants