from Hacker News

Show HN: LLMEasyTools – Tools for LLM agents (Python lib)

by zby on 8/12/24, 12:14 PM with 3 comments

A 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...

  • by spdustin on 8/12/24, 4:25 PM

    The 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.

  • by namanyayg on 8/12/24, 1:54 PM

    nice 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?