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

Function calling / tool use #24

Open
Boscop opened this issue Sep 24, 2024 · 8 comments
Open

Function calling / tool use #24

Boscop opened this issue Sep 24, 2024 · 8 comments
Labels
in-progress This ticket is in the work, first commit might have been put in master. planned-feature Feature that is planned for implementation

Comments

@Boscop
Copy link

Boscop commented Sep 24, 2024

It would be really great if you could prioritize adding support for function calling / tool use :)
I started using this crate for a project where I need function calling, and then realized that this crate doesn't support it yet..
For now I'll emulate it by telling the model in the system prompt to output json in a certain format whenever it wants to "call a function", but it's a hacky workaround.

Please let me know, what's your planned timeline for adding function calling? :)

Thanks 🙏
I really appreciate your work on this crate 🙂

Btw, in general it would be very helpful to have an intended Roadmap in the Readme, or have a GitHub project that implies one :)

@jeremychone
Copy link
Owner

@Boscop Yes, make sense. Ok, this is next on the list now.

@jeremychone jeremychone added the planned-feature Feature that is planned for implementation label Sep 25, 2024
@Boscop
Copy link
Author

Boscop commented Sep 28, 2024

Thanks so much 😊

@jeremychone
Copy link
Owner

@Boscop I did the first pass for OpenAI and Anthropic (see above for the commit). Not released yet, more work to be done, but just to let you know that this is in progress.

@jeremychone jeremychone added the in-progress This ticket is in the work, first commit might have been put in master. label Oct 30, 2024
@jBernavaPrah
Copy link
Contributor

Hi @jeremychone!

I would love to use your crate to simplify my project, but I will need at least the function calls/tools to be available. :)

What is the status and the timing to publish it and is there anyhow that I can help you? :)

Thanks a lot!

@jeremychone
Copy link
Owner

@jBernavaPrah A first pass at it has been implemented for openai adapter. You can check the test files.

@Boscop
Copy link
Author

Boscop commented Jan 16, 2025

It would be great if function calling could be done in a nice typed way like https://github.com/frankfralick/openai-func-enums (but not just for OpenAI).

@jeremychone
Copy link
Owner

@Boscop Sorry for the late response. Here are a couple of points:

  • Tool/function calling has been implemented for a while for OpenAI (and compatible APIs) and Anthropic.

  • I am working on adding Gemini now.

  • The reason why fully typed function calling is not part of the scope (and independent of supporting multiple AI models) is because I would like to keep it pretty open right now and allow some flexibility. In fact, it allows for a little bit more support, as it is less tightly bound to one way of thinking.

    • So, the Tool type takes schema as a JSON Value object and returns a JSON value.
    • One can use schemars if they want to have full types (definitely a very cool lib).
    • Eventually, perhaps, I might add some more "optional" types for convenience and model portability, but this is not part of the initial support.

Hope this answers the questions.

Have fun with tool support for OpenAI and Anthropic today; Gemini is coming soon.

I will also add some examples/...-tool.rs to better demonstrate how it works.

Happy coding!

@jeremychone
Copy link
Owner

@jBernavaPrah did you try the tool support?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in-progress This ticket is in the work, first commit might have been put in master. planned-feature Feature that is planned for implementation
Projects
None yet
Development

No branches or pull requests

3 participants