Skip to content

Instantly share code, notes, and snippets.

@Justin99b
Justin99b / gist:80e71b1a37b4969de2c039c247a79724
Created February 16, 2025 01:02
VLLM Command-r Tool Parser plugin
# Made by @Braunworks
import re
import json
from typing import Sequence, Any, Union
from vllm.entrypoints.openai.protocol import (
ChatCompletionRequest,
DeltaFunctionCall,
DeltaMessage,
DeltaToolCall,
{%- macro json_to_python_type(json_spec) %}
{%- set basic_type_map = {
"string": "str",
"number": "float",
"integer": "int",
"boolean": "bool"
} %}
{%- if basic_type_map[json_spec.type] is defined %}