Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Add functionary support #784

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

Merged
merged 9 commits into from
Nov 3, 2023
Merged

Add functionary support #784

merged 9 commits into from
Nov 3, 2023

Conversation

abetlen
Copy link
Owner

@abetlen abetlen commented Oct 2, 2023

Overview

Adds support for proper OpenAI function calling using the functionary language model.

This model is capable of performing openai style funciton calling, selecting functions dynamically, and regular chat completions.

Link to model in GGUF format

  • Functionary Custom Format
  • Functionary Response Formatting (tricky)
  • Test with OpenAI tests and instructor library
  • Clean up API

Notes

It was straightforward enough to fit Functionary's prompt formatting into the new format method
image
and the quantized model behaves as expected however it's clear that the current API is inadequate to handle function calling properly
image

To do this correctlly we need to

  • Format the incoming message requests to functionary format
  • Generate up to the end of the assistant message (next : character) to see if any function is called while not returning any of the generated tokens up until that point.
  • If it is perform constrained generation and start returning tokens

Update: It Works!

image

@abetlen abetlen marked this pull request as ready for review November 3, 2023 06:12
@abetlen abetlen merged commit 3af7b21 into main Nov 3, 2023
@abetlen abetlen deleted the add-functionary-support branch November 14, 2023 20:07
@teleprint-me
Copy link
Contributor

teleprint-me commented Nov 26, 2023

I noticed functionary is specific to a model even though grammar is general enough to support any model (unless I'm misunderstanding something here). Not a big deal as I still haven't had time to look at the updates yet. I'll be doing that tonight and tomorrow. I'll (hopefully) know and understand more about the status quo by then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.