superagent-ai / superagent

🥷 Run AI-agents with an API
https://docs.superagent.sh
MIT License
5.29k stars 835 forks source link

Structured output parsing #120

Closed homanp closed 1 year ago

homanp commented 1 year ago

⚠️ Please check that this feature request hasn't been suggested before.

🔖 Feature description

Sometimes a user wants structure the output of the agent, e.g like JSON etc.

Would be nice to create an API for this where the user can post their schema.

📝 Additional Context

No response

Acknowledgements

arashilmg commented 1 year ago

Without This, I need to use another runtime/app/framework (e.x. Langchain Output Parser) to just parse the output to structured JSON. Because any real-life integration I can think of requires a JSON structured input/outpu.

Basically, without this feature, It might make more sense to just ignore this project totally and just use everything in one single runtime (e.x. using Langchain SDK)

Thank you @homanp for this great project though

arashilmg commented 1 year ago

This feature ideally should support a refine/retry process or validation as well, something like auto-fixer: https://python.langchain.com/docs/modules/model_io/output_parsers/output_fixing_parser

homanp commented 1 year ago

Without This, I need to use another runtime/app/framework (e.x. Langchain Output Parser) to just parse the output to structured JSON. Because any real-life integration I can think of requires a JSON structured input/outpu.

Basically, without this feature, It might make more sense to just ignore this project totally and just use everything in one single runtime (e.x. using Langchain SDK)

Thank you @homanp for this great project though

@arashilmg I agree with the output parsing. This is something we are actively working on and will release in the next version of Superagent (v0.1.0). Although it will not be based on LangChain.

With regards to using LangChain over Superagent there are ultimately several factors a user needs to consider when choosing any framework for a project. Superagent is more focused on provisioning of agents in production use cases. I'm in tight dialogue with LangChain core team as I believe it to be a fundamental part of the stack.

But we serve different user segments and purposes.

Thank you for you kind words, our goal is to build something useful an enable any developer to integrate AI features in any app.

🙏🙏🙏