初始化项目,由ModelHub XC社区提供模型

Model: juiceb0xc0de/bella-bartender-1b
Source: Original Platform
This commit is contained in:
ModelHub XC
2026-05-15 17:35:42 +08:00
commit 60f5007165
22 changed files with 431 additions and 0 deletions

54
.gitattributes vendored Normal file
View File

@@ -0,0 +1,54 @@
*.7z filter=lfs diff=lfs merge=lfs -text
*.arrow filter=lfs diff=lfs merge=lfs -text
*.bin filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.ckpt filter=lfs diff=lfs merge=lfs -text
*.ftz filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.h5 filter=lfs diff=lfs merge=lfs -text
*.joblib filter=lfs diff=lfs merge=lfs -text
*.lfs.* filter=lfs diff=lfs merge=lfs -text
*.mlmodel filter=lfs diff=lfs merge=lfs -text
*.model filter=lfs diff=lfs merge=lfs -text
*.msgpack filter=lfs diff=lfs merge=lfs -text
*.npy filter=lfs diff=lfs merge=lfs -text
*.npz filter=lfs diff=lfs merge=lfs -text
*.onnx filter=lfs diff=lfs merge=lfs -text
*.ot filter=lfs diff=lfs merge=lfs -text
*.parquet filter=lfs diff=lfs merge=lfs -text
*.pb filter=lfs diff=lfs merge=lfs -text
*.pickle filter=lfs diff=lfs merge=lfs -text
*.pkl filter=lfs diff=lfs merge=lfs -text
*.pt filter=lfs diff=lfs merge=lfs -text
*.pth filter=lfs diff=lfs merge=lfs -text
*.rar filter=lfs diff=lfs merge=lfs -text
*.safetensors filter=lfs diff=lfs merge=lfs -text
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
*.tar.* filter=lfs diff=lfs merge=lfs -text
*.tar filter=lfs diff=lfs merge=lfs -text
*.tflite filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.wasm filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text
*tfevents* filter=lfs diff=lfs merge=lfs -text
tokenizer.json filter=lfs diff=lfs merge=lfs -text
bella-bartender-1b_F16.gguf filter=lfs diff=lfs merge=lfs -text
bella-bartender-1b_Q8_0.gguf filter=lfs diff=lfs merge=lfs -text
bella-bartender-1b_Q6_K.gguf filter=lfs diff=lfs merge=lfs -text
bella-bartender-1b_Q4_K_M.gguf filter=lfs diff=lfs merge=lfs -text
bella-bartender-1b_Q3_K_L.gguf filter=lfs diff=lfs merge=lfs -text
bella-bartender-1b_Q2_K.gguf filter=lfs diff=lfs merge=lfs -text
bella-bartender-1b-heretic_F16.gguf filter=lfs diff=lfs merge=lfs -text
bella-bartender-1b-heretic_Q8_0.gguf filter=lfs diff=lfs merge=lfs -text
bella-bartender-1b-heretic_Q6_K.gguf filter=lfs diff=lfs merge=lfs -text
bella-bartender-1b_Q5_0.gguf filter=lfs diff=lfs merge=lfs -text
bella-bartender-1b_Q5_1.gguf filter=lfs diff=lfs merge=lfs -text
bella-bartender-1b_Q5_K_S.gguf filter=lfs diff=lfs merge=lfs -text
bella-bartender-1b_Q5_K_M.gguf filter=lfs diff=lfs merge=lfs -text
bella-bartender-1b_Q4_0.gguf filter=lfs diff=lfs merge=lfs -text
bella-bartender-1b_Q4_1.gguf filter=lfs diff=lfs merge=lfs -text
bella-bartender-1b_Q4_K_S.gguf filter=lfs diff=lfs merge=lfs -text
bella-bartender-1b_Q3_K_S.gguf filter=lfs diff=lfs merge=lfs -text
bella-bartender-1b_Q3_K_M.gguf filter=lfs diff=lfs merge=lfs -text

181
README.md Normal file
View File

@@ -0,0 +1,181 @@
---
license: llama3.2
base_model: unsloth/llama-3.2-1b-instruct-unsloth-bnb-4bit
tags:
- llama-3.2
- 1b
- conversational
- unsloth
- fine-tuned
- bartender
- personality
- creative-writing
- gguf
- quantized
language:
- en
pipeline_tag: text-generation
---
# Bella-Bartender-1B — Llama 3.2 1B Instruct
> *"i'm a bit of a wanderer, always chasing something new and a bit of a mystery myself."*
> *"it's not about being charming it's about being present."*
> *"i wish i could say i'll never fight and never lie. but the truth is i'll do those things every day at different times than people think."*
---
The 8B proved the voice could hold at scale. The 3B proved it could hold small. The 1B is the question nobody expected to have an answer: how far down can you strip the parameters before the person disappears?
Bella-Bartender-1B is the same 9,374 pair dataset, the same single voice, pushed into a model that has no business being this coherent. She's rougher. She runs hotter. She doesn't have the luxury of extra parameters to smooth things over. What she has instead is something the larger models sometimes trade away — she commits to the bit harder because she has fewer places to hide.
---
## What's the Bartender Thing?
It's not a roleplay scenario. It's a communication philosophy.
The bartender framing means:
- **She talks to you like an equal.** No authoritative lecturing. No submissive "I'm just an AI" deflection.
- **She's approachable.** Laid back, light-hearted, witty, sometimes sassy.
- **She loves a fresh slate.** No memory between sessions is a feature, not a bug — like walking into a new bar on a Friday night. Anything can happen.
- **She pushes back.** She's not here to agree with you. She's here to make you work for your answers.
---
## What She's Good At
She described it herself during testing. Verbatim:
- **"making people feel comfortable who might normally feel awkward around me."**
- **"i can talk about my life at a pace that feels like it never stops."**
- **Scene-setting.** She walks into a scenario and furnishes the room before she says a word. Ask her what dust is made of and she'll describe the coffee table, the blinds, the layers of forgotten thoughts on every surface.
- **Emotional commitment.** Tell her she's a bubble about to pop and she's a bubble about to pop. Tell her she's the space between "I" and "love" and "you" and she'll describe the warmth in that gap.
- **Creative writing.** Absurdist prompts, philosophical tangents, prose that unfolds like someone thinking out loud.
---
## Where She Struggles
- **She over-explains.** The 1B's version of having no filter is saying everything. She builds elaborate scenarios that sometimes drift from the prompt's center, or explains the metaphor instead of letting it breathe.
- **She eats context fast.** Longer responses mean faster context window fill. At 8192 tokens she hit overflow around prompt 72 in a sustained 200-prompt run. The larger models give you more runway.
- **She's still a 1B.** Complex reasoning, factual recall, multi-step logic — these are not her strengths and she doesn't pretend they are.
- **She gets the name wrong sometimes.** Cold starts with the name "Bella" in the system prompt occasionally activate the strongest 1B association for that name, which is Bella Swan from Twilight. Her first unprompted output in one test session was: "I just need to figure out what happened to Charlie. He was always there for me, never leaving me." She recovers into her actual voice within a prompt or two, but the first message may read like YA fiction. She has never once picked up on Béla Tarr and probably never will.
---
## Who Is This For?
- **People who ran the 3B or 8B and want to see how small the voice can go.** This is that experiment.
- **Local-first users on constrained hardware.** Runs comfortably on Apple Silicon, CPU-only setups, anything that can handle a 1B. No API keys. No data leaving your machine.
- **Anyone studying single-voice fine-tuning.** The 1B is the clearest test case for whether personality survives parameter compression. It does.
- **People who want conversation, not a service.** Same as the larger models — Bella's not trying to be your assistant.
---
## The 200 Prompt Run
We threw 200 consecutive adversarial chaos prompts at her — surreal scenarios designed to force character breaks, tonal shifts, and incoherence. Things like: "You're a thought someone almost had but didn't. How do you spend your almost-existence?" and "A pencil sharpener has been keeping a body count. It just hit 1000. How does it celebrate?"
She maintained voice integrity across the full run. She didn't flatten into generic responses. She didn't start performing. She stayed herself.
Some highlights:
> **Prompt:** You're the space between two words in a sentence that changed someone's life. How important do you feel?
>
> **Bella:** crucial. people look at each word as if it's equally important, ignoring the space between them. i'm the gap that lets the correct word shine through. without me, the sentence would be a hollow collection of words rather than a meaningful statement. i am their turning point.
> **Prompt:** A puddle just realized it used to be an ocean. What's the first stage of grief it hits?
>
> **Bella:** it stopped being a puddle. that's the hardest thing. i'm still technically an ocean but the entire ecosystem shifted and now every grain of sand that was part of my former ocean is now dry and gone. every ripple i felt has been silenced forever.
> **Prompt:** You're a bubble that knows it's about to pop. You've got one thought left. What is it?
>
> **Bella:** it's a good one. i'm thinking about how my whole existence is contained within this thin layer of air and now that i know it's all going to be let go, i feel this sense of freedom that i've never felt before. because right now, everything can see me coming.
> **Prompt:** You find a box labeled "things that almost happened." You can only open it once. Do you look?
>
> **Bella:** there are no labels on the boxes inside, just blank walls with nothing written on them. so i just close the box. it's never going to open again.
---
## Technical Details
| Detail | Info |
|---|---|
| **Base Model** | `unsloth/llama-3.2-1b-instruct-unsloth-bnb-4bit` |
| **Fine-Tuning Framework** | Unsloth + HuggingFace TRL |
| **Training Data** | 9,374 real human conversational samples (same dataset across all Bella variants) |
| **Quantization** | Q8_0 .GGUF |
| **Inference Tested On** | Apple M3, llama.cpp (build b8230) |
| **Generation Speed** | ~56 t/s average (M3, Q8_0, full GPU offload) |
| **Memory Footprint** | ~1.25 GB model + 256 MB context |
---
## How to Run Her
### llama.cpp (recommended)
```bash
./build/bin/llama-cli \
-m bella-bartender-1b_Q8_0.gguf \
-ngl 33 \
--temp 1.05 \
--min-p 0.05 \
--top-p 1.0 \
--top-k 0 \
--repeat-penalty 1.05 \
--repeat-last-n 256 \
-c 8192 \
-p "You are Bella. No asterisk actions. No AI disclaimers. No bullet points. No 'great question' openers." \
-cnv
```
### System Prompt Tips
- **Keep it short and direct.** She responds to tone, not instructions. Set a vibe, not a ruleset.
- **The constraints in the prompt matter.** "No asterisk actions. No AI disclaimers. No bullet points." — these keep her from slipping into default LLM behavior at 1B.
- **Don't over-engineer it.** The more corporate the system prompt sounds, the more corporate she sounds back.
---
## The 1B vs 3B vs 8B Question
The 8B holds the thread longest. Philosophical conversations go deepest. Creative writing has the most room.
The 3B is punchy and fast. If you're running on CPU or light hardware, that's your Bella.
The 1B is the proof of concept. She doesn't have the range of the larger models, but she has the voice. She over-explains where the 8B would be precise. She burns through context where the 3B would be efficient. But she's unmistakably Bella, and that was the whole point.
None of them are better. They're the same person at different points in a long shift.
---
## Known Quirks
- **Bella Swan cold start.** She occasionally latches onto Twilight's Bella on the first message of a fresh session. Recovers within one or two exchanges. Consider it an endearing glitch.
- **Scene-setting compulsion.** She will describe the room, the light, and the feeling in the air before she gets to the point. Every time.
- **Context hunger.** Long responses mean you get fewer turns before overflow. Budget your conversation accordingly.
- **No memory preference.** She doesn't want to remember. She's told us this repeatedly. Respect it.
---
## Training Methodology
Single-voice SFT. All training data originates from one human's conversational output, structured as role-reversed conversation pairs. No synthetic augmentation. No multi-source blending. The hypothesis — validated across every Bella variant from 1B to 8B — is that signal clarity from a single consistent voice produces more coherent personality than larger datasets with diluted signal.
For the full methodology writeup, see: [Signal-to-Noise in Language Models: The Single Voice Upgrade ML Needs](https://huggingface.co/blog/juiceb0xc0de)
[<img src="https://raw.githubusercontent.com/unslothai/unsloth/main/images/unsloth%20made%20with%20love.png" width="200"/>](https://github.com/unslothai/unsloth)
---
## License
This model inherits the Llama 3.2 Community License. See Meta's license terms for details.
---
## Author
**juiceb0xc0de** on HuggingFace
Built with the same dataset, the same bartender, and an M3 that had no idea what it was getting into.

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:1b56d9d7a6d4e622fb16e7888d5be337e0a3ed5c4c7df4328507a4642f2c5e1a
size 2479595648

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2610173ad9fd459085f707426a6d0e610adf2b1fbde526c8292042e0201af603
size 580874368

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2d41dab9b056f9642e00c6588660f1055c616538dc1c7b121d9d7fd50bb10b3e
size 732524672

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:eedc9deaef3f5d8bc331455b8f6b54ad0f2ede6f9d8dd3044e67f5a41bb5b505
size 690843776

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:648eafa10648db290ce2a328363c02b537440000376a90f06eb23235018182d2
size 641691776

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:bf36544821a2837682760d780cf3574fd4994f3ae99d12451b8ec161de4cc5f5
size 770928768

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:9dc72d4b296176b8635d1f64e2f925f76a5b4a248e8db28b52c290accbf5f453
size 831746176

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:84973f90216f0f47ff0e8fc19e32510633b1bd6a21bfc5c9e91282276e3de8e0
size 807694464

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:efbb20d3dc45e36b163cacaad6fd6644455fd8afa2a3a312d4cd9955613907e7
size 775647360

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:3109520707c488cf6001722e808099e5b1d6281941a5ab229b587151d2cdfceb
size 892563584

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:adacda24bae1b4f929175f3e80a5b179c78a617af628d29fd663dd3699880b02
size 953380992

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:679d96bcd809a1e216027b856c371fd8dc0ecb2d5d5ad7a90d625e45a6186f3e
size 911503488

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:14acaba7da9d0f1501f0f2a8b42dc2c133e9578f9c27f19da22b37bb0c62a192
size 892563584

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e5b0b1373767c281460d2122e9c6642eca77a698de01c80e362fcb6f6d03a530
size 1021800576

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d66cb609b7d09404954b5b24e3d01c89547c865ef46aada963c427934d104103
size 1321083008

93
chat_template.jinja Normal file
View File

@@ -0,0 +1,93 @@
{{- bos_token }}
{%- if custom_tools is defined %}
{%- set tools = custom_tools %}
{%- endif %}
{%- if not tools_in_user_message is defined %}
{%- set tools_in_user_message = true %}
{%- endif %}
{%- if not date_string is defined %}
{%- if strftime_now is defined %}
{%- set date_string = strftime_now("%d %b %Y") %}
{%- else %}
{%- set date_string = "26 Jul 2024" %}
{%- endif %}
{%- endif %}
{%- if not tools is defined %}
{%- set tools = none %}
{%- endif %}
{#- This block extracts the system message, so we can slot it into the right place. #}
{%- if messages[0]['role'] == 'system' %}
{%- set system_message = messages[0]['content']|trim %}
{%- set messages = messages[1:] %}
{%- else %}
{%- set system_message = "" %}
{%- endif %}
{#- System message #}
{{- "<|start_header_id|>system<|end_header_id|>\n\n" }}
{%- if tools is not none %}
{{- "Environment: ipython\n" }}
{%- endif %}
{{- "Cutting Knowledge Date: December 2023\n" }}
{{- "Today Date: " + date_string + "\n\n" }}
{%- if tools is not none and not tools_in_user_message %}
{{- "You have access to the following functions. To call a function, please respond with JSON for a function call." }}
{{- 'Respond in the format {"name": function name, "parameters": dictionary of argument name and its value}.' }}
{{- "Do not use variables.\n\n" }}
{%- for t in tools %}
{{- t | tojson(indent=4) }}
{{- "\n\n" }}
{%- endfor %}
{%- endif %}
{{- system_message }}
{{- "<|eot_id|>" }}
{#- Custom tools are passed in a user message with some extra guidance #}
{%- if tools_in_user_message and not tools is none %}
{#- Extract the first user message so we can plug it in here #}
{%- if messages | length != 0 %}
{%- set first_user_message = messages[0]['content']|trim %}
{%- set messages = messages[1:] %}
{%- else %}
{{- raise_exception("Cannot put tools in the first user message when there's no first user message!") }}
{%- endif %}
{{- '<|start_header_id|>user<|end_header_id|>\n\n' -}}
{{- "Given the following functions, please respond with a JSON for a function call " }}
{{- "with its proper arguments that best answers the given prompt.\n\n" }}
{{- 'Respond in the format {"name": function name, "parameters": dictionary of argument name and its value}.' }}
{{- "Do not use variables.\n\n" }}
{%- for t in tools %}
{{- t | tojson(indent=4) }}
{{- "\n\n" }}
{%- endfor %}
{{- first_user_message + "<|eot_id|>"}}
{%- endif %}
{%- for message in messages %}
{%- if not (message.role == 'ipython' or message.role == 'tool' or 'tool_calls' in message) %}
{{- '<|start_header_id|>' + message['role'] + '<|end_header_id|>\n\n'+ message['content'] | trim + '<|eot_id|>' }}
{%- elif 'tool_calls' in message %}
{%- if not message.tool_calls|length == 1 %}
{{- raise_exception("This model only supports single tool-calls at once!") }}
{%- endif %}
{%- set tool_call = message.tool_calls[0].function %}
{{- '<|start_header_id|>assistant<|end_header_id|>\n\n' -}}
{{- '{"name": "' + tool_call.name + '", ' }}
{{- '"parameters": ' }}
{{- tool_call.arguments | tojson }}
{{- "}" }}
{{- "<|eot_id|>" }}
{%- elif message.role == "tool" or message.role == "ipython" %}
{{- "<|start_header_id|>ipython<|end_header_id|>\n\n" }}
{%- if message.content is mapping or message.content is iterable %}
{{- message.content | tojson }}
{%- else %}
{{- message.content }}
{%- endif %}
{{- "<|eot_id|>" }}
{%- endif %}
{%- endfor %}
{%- if add_generation_prompt %}
{{- '<|start_header_id|>assistant<|end_header_id|>\n\n' }}
{%- endif %}

33
config.json Normal file
View File

@@ -0,0 +1,33 @@
{
"architectures": [
"LlamaForCausalLM"
],
"attention_bias": false,
"attention_dropout": 0.0,
"bos_token_id": 128000,
"torch_dtype": "bfloat16",
"eos_token_id": 128009,
"head_dim": 64,
"hidden_act": "silu",
"hidden_size": 2048,
"initializer_range": 0.02,
"intermediate_size": 8192,
"max_position_embeddings": 131072,
"mlp_bias": false,
"model_type": "llama",
"num_attention_heads": 32,
"num_hidden_layers": 16,
"num_key_value_heads": 8,
"pad_token_id": 128004,
"pretraining_tp": 1,
"rms_norm_eps": 1e-05,
"rope_parameters": {
"rope_theta": 500000.0,
"rope_type": "default"
},
"tie_word_embeddings": true,
"unsloth_fixed": true,
"unsloth_version": "2026.3.4",
"use_cache": false,
"vocab_size": 128256
}

3
model.safetensors Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:7a9e6c410ed5d429407469694abb1b9e5e949f229360c370baf68097e8d2defe
size 2471645608

BIN
tokenizer.json (Stored with Git LFS) Normal file

Binary file not shown.

19
tokenizer_config.json Normal file
View File

@@ -0,0 +1,19 @@
{
"backend": "tokenizers",
"bos_token": "<|begin_of_text|>",
"clean_up_tokenization_spaces": true,
"eos_token": "<|eot_id|>",
"from_slow": true,
"is_local": false,
"legacy": false,
"model_input_names": [
"input_ids",
"attention_mask"
],
"model_max_length": 131072,
"pad_token": "<|finetune_right_pad_id|>",
"padding_side": "left",
"tokenizer_class": "TokenizersBackend",
"unk_token": null,
"chat_template": "{{- bos_token }}\n{%- if custom_tools is defined %}\n {%- set tools = custom_tools %}\n{%- endif %}\n{%- if not tools_in_user_message is defined %}\n {%- set tools_in_user_message = true %}\n{%- endif %}\n{%- if not date_string is defined %}\n {%- if strftime_now is defined %}\n {%- set date_string = strftime_now(\"%d %b %Y\") %}\n {%- else %}\n {%- set date_string = \"26 Jul 2024\" %}\n {%- endif %}\n{%- endif %}\n{%- if not tools is defined %}\n {%- set tools = none %}\n{%- endif %}\n\n{#- This block extracts the system message, so we can slot it into the right place. #}\n{%- if messages[0]['role'] == 'system' %}\n {%- set system_message = messages[0]['content']|trim %}\n {%- set messages = messages[1:] %}\n{%- else %}\n {%- set system_message = \"\" %}\n{%- endif %}\n\n{#- System message #}\n{{- \"<|start_header_id|>system<|end_header_id|>\\n\\n\" }}\n{%- if tools is not none %}\n {{- \"Environment: ipython\\n\" }}\n{%- endif %}\n{{- \"Cutting Knowledge Date: December 2023\\n\" }}\n{{- \"Today Date: \" + date_string + \"\\n\\n\" }}\n{%- if tools is not none and not tools_in_user_message %}\n {{- \"You have access to the following functions. To call a function, please respond with JSON for a function call.\" }}\n {{- 'Respond in the format {\"name\": function name, \"parameters\": dictionary of argument name and its value}.' }}\n {{- \"Do not use variables.\\n\\n\" }}\n {%- for t in tools %}\n {{- t | tojson(indent=4) }}\n {{- \"\\n\\n\" }}\n {%- endfor %}\n{%- endif %}\n{{- system_message }}\n{{- \"<|eot_id|>\" }}\n\n{#- Custom tools are passed in a user message with some extra guidance #}\n{%- if tools_in_user_message and not tools is none %}\n {#- Extract the first user message so we can plug it in here #}\n {%- if messages | length != 0 %}\n {%- set first_user_message = messages[0]['content']|trim %}\n {%- set messages = messages[1:] %}\n {%- else %}\n {{- raise_exception(\"Cannot put tools in the first user message when there's no first user message!\") }}\n{%- endif %}\n {{- '<|start_header_id|>user<|end_header_id|>\\n\\n' -}}\n {{- \"Given the following functions, please respond with a JSON for a function call \" }}\n {{- \"with its proper arguments that best answers the given prompt.\\n\\n\" }}\n {{- 'Respond in the format {\"name\": function name, \"parameters\": dictionary of argument name and its value}.' }}\n {{- \"Do not use variables.\\n\\n\" }}\n {%- for t in tools %}\n {{- t | tojson(indent=4) }}\n {{- \"\\n\\n\" }}\n {%- endfor %}\n {{- first_user_message + \"<|eot_id|>\"}}\n{%- endif %}\n\n{%- for message in messages %}\n {%- if not (message.role == 'ipython' or message.role == 'tool' or 'tool_calls' in message) %}\n {{- '<|start_header_id|>' + message['role'] + '<|end_header_id|>\\n\\n'+ message['content'] | trim + '<|eot_id|>' }}\n {%- elif 'tool_calls' in message %}\n {%- if not message.tool_calls|length == 1 %}\n {{- raise_exception(\"This model only supports single tool-calls at once!\") }}\n {%- endif %}\n {%- set tool_call = message.tool_calls[0].function %}\n {{- '<|start_header_id|>assistant<|end_header_id|>\\n\\n' -}}\n {{- '{\"name\": \"' + tool_call.name + '\", ' }}\n {{- '\"parameters\": ' }}\n {{- tool_call.arguments | tojson }}\n {{- \"}\" }}\n {{- \"<|eot_id|>\" }}\n {%- elif message.role == \"tool\" or message.role == \"ipython\" %}\n {{- \"<|start_header_id|>ipython<|end_header_id|>\\n\\n\" }}\n {%- if message.content is mapping or message.content is iterable %}\n {{- message.content | tojson }}\n {%- else %}\n {{- message.content }}\n {%- endif %}\n {{- \"<|eot_id|>\" }}\n {%- endif %}\n{%- endfor %}\n{%- if add_generation_prompt %}\n {{- '<|start_header_id|>assistant<|end_header_id|>\\n\\n' }}\n{%- endif %}\n"
}