tabbyAPI-ollama/common
Ben Gitter 70b9fc95de
[WIP] OpenAI Tools Support/Function calling (#154)
* returning stop str if exists from gen

* added chat template for firefunctionv2

* pulling tool vars from template

* adding parsing for tool inputs/outputs

* passing tool data from endpoint to chat template, adding tool_start to the stop list

* loosened typing on the response tool call, leaning more on the user supplying a quality schema if they want a particular format

* non streaming generation prototype

* cleaning template

* Continued work with type, ingestion into template, and chat template for fire func

* Correction - streaming toolcall comes back as delta obj not inside chatcomprespchoice per chat_completion_chunk.py inside OAI lib.

* Ruff Formating

* Moved stop string and tool updates out of prompt creation func

Updated tool pydantic to match OAI

Support for streaming

Updated generate tool calls to use flag within chat_template and insert tool reminder

* Llama 3.1 chat templates

Updated fire func template

* renamed llama3.1 to chatml_with_headers..

* update name of template

* Support for calling a tool start token rather than the string.

Simplified tool_params

Warning when gen_settings are being overidden becuase user set temp to 0

Corrected schema and tools to correct types for function args. Str for some reason

* draft groq tool use model template

* changed headers to vars for readablity (but mostly because some models are weird about newlines after headers, so this is an easier way to change globally)

* Clean up comments and code in chat comp

* Post processed tool call to meet OAI spec rather than forcing model to write json in a string in the middle of the call.

* changes example back to args as json rather than string of json

* Standardize chat templates to each other

* cleaning/rewording

* stop elements can also be ints (tokens)

* Cleaning/formatting

* added special tokens for tools and tool_response as specified in description

* Cleaning

* removing aux templates - going to live in llm-promp-templates repo instead

* Tree: Format

Signed-off-by: kingbri <bdashore3@proton.me>

* Chat Completions: Don't include internal tool variables in OpenAPI

Use SkipJsonSchema to supress inclusion with the OpenAPI JSON. The
location of these variables may need to be changed in the future.

Signed-off-by: kingbri <bdashore3@proton.me>

* Templates: Deserialize metadata on template load

Since we're only looking for specific template variables that are
static in the template, it makes more sense to render when the template
is initialized.

Signed-off-by: kingbri <bdashore3@proton.me>

* Tools: Fix comments

Adhere to the format style of comments in the rest of the project.

Signed-off-by: kingbri <bdashore3@proton.me>

---------

Co-authored-by: Ben Gitter <gitterbd@gmail.com>
Signed-off-by: kingbri <bdashore3@proton.me>
2024-08-17 00:16:25 -04:00
..
args.py Args: Add api-servers to parser 2024-08-08 16:32:29 -04:00
auth.py Auth: Fix disable auth when checking for key permissions 2024-07-26 15:04:29 -04:00
concurrency.py API + Model: Add blocks and checks for various load requests 2024-05-25 21:16:14 -04:00
config.py Embeddings: Update config, args, and parameter names 2024-07-30 15:32:26 -04:00
downloader.py Downloader: Make timeout configurable 2024-07-23 21:42:38 -04:00
gen_logging.py Model: Attach request ID to logs 2024-08-01 00:25:54 -04:00
logger.py API: Add HuggingFace downloader 2024-04-29 01:15:02 -04:00
model.py Model: Bypass lock checks when shutting down 2024-08-03 16:05:34 -04:00
networking.py API: Add request logging 2024-07-22 21:40:00 -04:00
sampling.py [WIP] OpenAI Tools Support/Function calling (#154) 2024-08-17 00:16:25 -04:00
signals.py Model: Bypass lock checks when shutting down 2024-08-03 16:05:34 -04:00
templating.py [WIP] OpenAI Tools Support/Function calling (#154) 2024-08-17 00:16:25 -04:00
transformers_utils.py Tree: Format 2024-07-26 18:33:04 -04:00
utils.py Model: Add support for HuggingFace config and bad_words_ids 2024-07-26 18:23:22 -04:00