langchaingo
langchaingo copied to clipboard
examples: Add use of Defined outputparser in LLMChain
Note to maintainers
Hi, @tmc!
While this example works, there are a number of issues I have that you can help walk me through.
- LLMChain doesn't consider the outputparser's format instructions when sending the prompt. It seems a good solution should, but that might be a departure from Python LangChain (not sure) and would need consideration on how to not break things.
- There's a type assertion to extract the output struct from the outputparser which is unwieldy and unexpected necessary due to https://github.com/tmc/langchaingo/blob/main/chains/llm.go#L53 where the map value must be type
any.
For both these issues, I'm not sure I see a solution that behaves like LangChain yet is practical. It leads me to wonder, as far would you be interested in deviating from LangChain and building what is optimal based on both Go and the technical opinions by leadership on this project?
PR Checklist
- [x] Read the Contributing documentation.
- [x] Read the Code of conduct documentation.
- [x] Name your Pull Request title clearly, concisely, and prefixed with the name of the primarily affected package you changed according to Good commit messages (such as
memory: add interfaces for X, Yorutil: add whizzbang helpers). - [x] Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
- [x] Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g.
Fixes #123). - [x] Describes the source of new concepts.
- [x] References existing implementations as appropriate.
- [x] Contains test coverage for new functions.
- [ ] Passes all
golangci-lintchecks.