/ Модель

Характеристики

Контекст
131 072 токена
Параметры
7,5 млрд
Размер весов
16,1 ГБ
Лицензия
MIT
Архитектура
llama · dense
Опубликована
19 дек 2024

functionary-v4r-small-preview

Генерация текстаТекст → текст6 профессий

Предварительная 7,5-миллиардная модель MeetKai на базе Llama для чата с последовательным и параллельным вызовом функций и анализом их результатов.

15скачиваний за 30 дней4лайкавеса обновлены24 дек 2024

Бенчмарки

Как модель справилась с задачами пользователей ailist и что о ней публикуют открытые лидерборды

Тесты пользователейпока нет

Никто ещё не опубликовал тест этой модели. Соберите бенчмарк из своих задач — результат появится здесь.

  1. Добавьте модель в бенчмарк

    Вместе с другими моделями категории «Текст» — сравнение идёт внутри одной категории.

  2. Опишите свои задачи

    Напишите запросы, при необходимости приложите файлы и эталонные ответы.

  3. Запустите и опубликуйте

    Модели ответят на каждую задачу, судья оценит ответы. Опубликованный результат появится на этой странице.

Публичные оценки

Из открытых лидербордов. Сравнивайте результаты одного теста при одинаковых условиях — отсутствие оценки не значит, что модель хуже.

В подключённых источниках результатов для этой модели пока нет.

Что умеет модель

Описание составлено по карточке модели и метаданным Hugging Face

meetkai/functionary-v4r-small-preview — языковая модель MeetKai для диалогов с вызовом функций и плагинов. Она основана на Meta-Llama-3.1-8B-Instruct и имеет плотную архитектуру LlamaForCausalLM с 7,5 млрд параметров. Модель принимает описания функций в формате JSON Schema и умеет выбирать, когда вызвать инструмент, выполнять вызовы последовательно или параллельно, учитывать их результаты и формировать ответ на их основе. Также поддерживает обычные ответы в чате и сценарии с интерпретатором кода.

Модель рассчитана на интеграцию в приложения и серверы, поддерживающие совместимый с OpenAI интерфейс; для подготовки запросов предусмотрен шаблон чата Functionary. В метаданных указан контекст до 131 072 токенов и формат весов safetensors. Лицензия — MIT. Карточка описывает предварительную версию и заявляет поддержку вызова инструментов, но не приводит результатов независимых оценок качества.

Сценарии применения

  • маршрутизация запросов к нужным функциям или плагинам
  • параллельный вызов нескольких инструментов в диалоге
  • ответы с опорой на результаты вызванных инструментов
  • встраивание вызова функций в OpenAI-совместимый чат-сервер
  • выполнение сценариев с интерпретатором кода

Ограничения

Карточка обозначает модель как предварительную версию и не приводит независимых оценок качества. Для вызовов функций требуется форматирование промпта по шаблону Functionary или совместимый сервер.

Для каких профессий подходит6

Разделы каталога профессий, в задачах которых используется эта модель

Все профессии

Также подходит для

Карточка модели

README от автора на Hugging Face, как он его опубликовал

Открыть на Hugging Face

Model Card for meetkai/functionary-v4r-small-preview

This model was based on meta-llama/Meta-Llama-3.1-8B-Instruct

https://github.com/MeetKai/functionary

Functionary is a language model that can interpret and execute functions/plugins.

The model determines when to execute functions, whether in parallel or serially, and can understand their outputs. It only triggers functions as needed. Function definitions are given as JSON Schema Objects, similar to OpenAI GPT function calls.

Key Features

  • Generate the reasoning before deciding tool uses
  • Intelligent parallel tool use
  • Able to analyze functions/tools outputs and provide relevant responses grounded in the outputs
  • Able to decide when to not use tools/call functions and provide normal chat response
  • Truly one of the best open-source alternative to GPT-4
  • Support code interpreter

How to Get Started

We provide custom code for parsing raw model responses into a JSON object containing role, content and tool_calls fields. This enables the users to read the function-calling output of the model easily.

from transformers import AutoModelForCausalLM, AutoTokenizer

tokenizer = AutoTokenizer.from_pretrained("meetkai/functionary-v4r-small-preview")
model = AutoModelForCausalLM.from_pretrained("meetkai/functionary-v4r-small-preview", device_map="auto", trust_remote_code=True)

tools = [
    {
        "type": "function",
        "function": {
            "name": "get_current_weather",
            "description": "Get the current weather",
            "parameters": {
                "type": "object",
                "properties": {
                    "location": {
                        "type": "string",
                        "description": "The city and state, e.g. San Francisco, CA"
                    }
                },
                "required": ["location"]
            }
        }
    }
]
# add this to make the model generate the reasoning first
tools.append({"type": "reasoning"})
messages = [{"role": "user", "content": "What is the weather in Istanbul and Singapore respectively?"}]

final_prompt = tokenizer.apply_chat_template(messages, tools, add_generation_prompt=True, tokenize=False)
inputs = tokenizer(final_prompt, return_tensors="pt").to("cuda")
pred = model.generate_tool_use(**inputs, max_new_tokens=128, tokenizer=tokenizer)
print(tokenizer.decode(pred.cpu()[0]))

Prompt Template

We convert function definitions to a similar text to TypeScript definitions. Then we inject these definitions as system prompts. After that, we inject the default system prompt. Then we start the conversation messages.

This formatting is also available via our vLLM server which we process the functions into Typescript definitions encapsulated in a system message using a pre-defined Transformers Jinja chat template. This means that the lists of messages can be formatted for you with the apply_chat_template() method within our server:

from openai import OpenAI

client = OpenAI(base_url="http://localhost:8000/v1", api_key="functionary")
messages = [{"role": "user",
            "content": "What is the weather for Istanbul?"}
    ]
tools = [{
            "type": "function",
            "function": {
                "name": "get_current_weather",
                "description": "Get the current weather",
                "parameters": {
                    "type": "object",
                    "properties": {
                        "location": {
                            "type": "string",
                            "description": "The city and state, e.g. San Francisco, CA"
                        }
                    },
                    "required": ["location"]
                }
            }
        }]

# Add reasoning type to make the model generate the reasoning first
tools.append({"type": "reasoning"})

client.chat.completions.create(
    model="path/to/functionary/model/",
    messages=messages,
    tools=tools,
    tool_choice="auto"
)

will yield:

<|start_header_id|>system<|end_header_id|>

Reasoning Mode: On


Cutting Knowledge Date: December 2023


You have access to the following functions:

Use the function 'get_current_weather' to 'Get the current weather'
{"name": "get_current_weather", "description": "Get the current weather", "parameters": {"type": "object", "properties": {"location": {"type": "string", "description": "The city and state, e.g. San Francisco, CA"}}, "required": ["location"]}}


Think very carefully before calling functions.
If a you choose to call a function ONLY reply in the following format:
<{start_tag}={function_name}>{parameters}{end_tag}
where

start_tag => `<function`
parameters => a JSON dict with the function argument name as key and function argument value as value.
end_tag => `</function>`

Here is an example,
<function=example_function_name>{"example_name": "example_value"}</function>

Reminder:
- If looking for real time information use relevant functions before falling back to brave_search
- Function calls MUST follow the specified format, start with <function= and end with </function>
- Required parameters MUST be specified
- Only call one function at a time
- Put the entire function call reply on one line

<|eot_id|><|start_header_id|>user<|end_header_id|>

What is the weather for Istanbul?

Run the model

We encourage users to run our models using our OpenAI-compatible vLLM server here.

The MeetKai Team

MeetKai Logo

Как запустить

На своей GPU в ailist. Цена — по текущим предложениям провайдеров

GPU в ailist

Универсальный рантайм

Можно запустить

Подбираем GPU…

Класс архитектуры
LlamaForCausalLM
Ревизия весов
5f234ff

0 моделей