3.1 KiB
Qwen 3: collection
The Qwen 3 family is a collection of hybrid reasoning MoE and non-MoE models ranging from 0.6b to 235b parameters.
Quick Start
hanzo run --isq 4 -m Qwen/Qwen3-8B
hanzo run --isq 4 -m Qwen/Qwen3-30B-A3B
Note: Hanzo Engine can load all FP8 pre-quantized versions natively! Simply replace the model ID.
Note: tool calling support is fully implemented for the Qwen 3 models, including agentic web search.
Enabling thinking
The Qwen 3 models are hybrid reasoning models which can be controlled at inference-time. By default, reasoning is enabled for these models. To dynamically control this, it is recommended to either add /no_think or /think to your prompt. Alternatively, you can specify the enable_thinking flag as detailed by the API-specific examples.
HTTP API
You can find a more detailed example demonstrating enabling/disabling thinking here.
hanzo serve --isq 4 -p 1234 -m Qwen/Qwen3-8B
from openai import OpenAI
client = OpenAI(api_key="foobar", base_url="http://localhost:1234/v1/")
completion = client.chat.completions.create(
model="default",
messages=[
{"role": "user", "content": "Tell me a story about the Rust type system."}
],
max_tokens=256,
)
print(completion.choices[0].message.content)
Python SDK
You can find a more detailed example demonstrating enabling/disabling thinking here.
from hanzo import Runner, Which, ChatCompletionRequest, Architecture
runner = Runner(
which=Which.Plain(
model_id="Qwen/Qwen3-8B",
arch=Architecture.Qwen3,
),
)
res = runner.send_chat_completion_request(
ChatCompletionRequest(
model="default",
messages=[
{"role": "user", "content": "Tell me a story about the Rust type system."}
],
max_tokens=256,
presence_penalty=1.0,
top_p=0.1,
temperature=0.1,
# enable_thinking=False,
)
)
print(res.choices[0].message.content)
print(res.usage)
Rust SDK
You can find a more detailed example demonstrating enabling/disabling thinking here.
use anyhow::Result;
use hanzo::{
IsqType, PagedAttentionMetaBuilder, TextMessageRole, TextMessages, TextModelBuilder,
};
#[tokio::main]
async fn main() -> Result<()> {
let model = TextModelBuilder::new("Qwen/Qwen3-8B")
.with_isq(IsqType::Q4K)
.with_logging()
.with_paged_attn(|| PagedAttentionMetaBuilder::default().build())?
.build()
.await?;
let messages = TextMessages::new()
// .enable_thinking(false)
.add_message(TextMessageRole::User, "Hello!");
let response = model.send_chat_request(messages).await?;
println!("{}", response.choices[0].message.content.as_ref().unwrap());
Ok(())
}