Show HN: LLMEasyTools – Tools for LLM agents (Python lib)
2 points by zby 10 months ago | 3 commentsA year ago I started working on a agentic RAG idea [1]. I quickly decided that I don't like the existing frameworks and started writing everything from scratch. The agentic RAG is not yet ready - but I extracted the code for dealing with function calling and published it. It is a small library for generating schemas from function signatures and for calling these functions using parameters constructed by the LLM.
There is not much code in it - but it is not as trivial as it would seem when you try to cover all the possible cases.
I think it is now quite well tested and useful.
1 - https://zzbbyy.substack.com/p/ai-applications-for-question-a...
- spdustin 10 months agoThe issue with using Pydantic's model_to_json is that nested objects will return a nested schema, and OpenAI ignores description annotations for anything not at the root level. In practice, that means any nested parameters (e.g. array of objects) need to be really well-named, or have their descriptions hoisted up to the parent parameter.
Even better: extract them to their own function, list all the resulting functions when composing the completion request, and re-assemble the final object when the completion is returned.
- namanyayg 10 months agonice work on extracting and open-sourcing this lib!
I'm working on an agentic b2b ai myself and i found the process to add different tools quite annoying. This is a great solution. alas, my code is in TypeScript.
i'm curious, how do you handle errors and edge cases when the LLM-generated params don't quite match the function signature?
- zby 10 months agoIn general I don't - but I have some minor cases where I try to fix the JSON - see the tests: https://github.com/zby/LLMEasyTools/blob/main/tests/processo... and https://github.com/zby/LLMEasyTools/blob/main/tests/processo...
- zby 10 months ago
- 10 months ago