Instructions to use RecursiveSI/flint with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use RecursiveSI/flint with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="RecursiveSI/flint") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("RecursiveSI/flint") model = AutoModelForCausalLM.from_pretrained("RecursiveSI/flint", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use RecursiveSI/flint with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "RecursiveSI/flint" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "RecursiveSI/flint", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/RecursiveSI/flint
- SGLang
How to use RecursiveSI/flint with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "RecursiveSI/flint" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "RecursiveSI/flint", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "RecursiveSI/flint" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "RecursiveSI/flint", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use RecursiveSI/flint with Docker Model Runner:
docker model run hf.co/RecursiveSI/flint
Download sglang/example_client.py from RecursiveSI/flint: direct link, hf CLI and curl.
- Browser
- Download file 2.49 kB
-
https://huggingface.co/RecursiveSI/flint/resolve/main/sglang/example_client.py
- Command line
-
hf download hf://RecursiveSI/flint/sglang/example_client.py
-
curl -L -o example_client.py https://huggingface.co/RecursiveSI/flint/resolve/main/sglang/example_client.py
2.49 kB
| """Minimal OpenAI-compatible client for a Flint SGLang server, with one tool-calling round trip. | |
| pip install openai | |
| python3 example_client.py --base-url http://localhost:30000/v1 [--api-key KEY] | |
| """ | |
| import argparse | |
| import json | |
| import os | |
| from openai import OpenAI | |
| SAMPLING = {"temperature": 1.0, "top_p": 0.95, "extra_body": {"top_k": 20}} | |
| MAX_TOKENS = 32768 # reasoning counts toward max_tokens | |
| TOOLS = [ | |
| { | |
| "type": "function", | |
| "function": { | |
| "name": "get_weather", | |
| "description": "Get the current weather for a city.", | |
| "parameters": { | |
| "type": "object", | |
| "properties": {"city": {"type": "string", "description": "City name"}}, | |
| "required": ["city"], | |
| }, | |
| }, | |
| } | |
| ] | |
| def main() -> None: | |
| parser = argparse.ArgumentParser() | |
| parser.add_argument("--base-url", default="http://localhost:30000/v1") | |
| parser.add_argument("--api-key", default=os.environ.get("FLINT_API_KEY", "unused")) | |
| args = parser.parse_args() | |
| client = OpenAI(base_url=args.base_url, api_key=args.api_key) | |
| messages = [ | |
| {"role": "system", "content": "You are a helpful assistant."}, | |
| {"role": "user", "content": "What's the weather in Paris right now?"}, | |
| ] | |
| first = client.chat.completions.create( | |
| model="flint", messages=messages, tools=TOOLS, max_tokens=MAX_TOKENS, **SAMPLING | |
| ) | |
| choice = first.choices[0] | |
| reply = choice.message | |
| print("reasoning:", getattr(reply, "reasoning_content", None)) | |
| print("tool calls:", reply.tool_calls) | |
| if choice.finish_reason == "length": | |
| print(f"cut off: the turn used all {MAX_TOKENS} tokens (reasoning counts toward max_tokens)") | |
| return | |
| if not reply.tool_calls: | |
| print("content:", reply.content) | |
| return | |
| # Echo the assistant turn (including reasoning_content) back unchanged, then add tool results. | |
| messages.append(reply.model_dump(exclude_none=True)) | |
| for call in reply.tool_calls: | |
| city = json.loads(call.function.arguments)["city"] | |
| messages.append( | |
| {"role": "tool", "tool_call_id": call.id, "content": json.dumps({"city": city, "forecast": "sunny, 21C"})} | |
| ) | |
| second = client.chat.completions.create( | |
| model="flint", messages=messages, tools=TOOLS, max_tokens=MAX_TOKENS, **SAMPLING | |
| ) | |
| print("final answer:", second.choices[0].message.content) | |
| if __name__ == "__main__": | |
| main() | |