Text Generation
Transformers
Safetensors
English
counsel
legal
law
reasoning
tool-use
chat
conversational
custom_code
Instructions to use judicialmind/Counsel-27B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use judicialmind/Counsel-27B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="judicialmind/Counsel-27B", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("judicialmind/Counsel-27B", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use judicialmind/Counsel-27B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "judicialmind/Counsel-27B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "judicialmind/Counsel-27B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/judicialmind/Counsel-27B
- SGLang
How to use judicialmind/Counsel-27B 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 "judicialmind/Counsel-27B" \ --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": "judicialmind/Counsel-27B", "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 "judicialmind/Counsel-27B" \ --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": "judicialmind/Counsel-27B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use judicialmind/Counsel-27B with Docker Model Runner:
docker model run hf.co/judicialmind/Counsel-27B
Download runtime/smoke_api.py from judicialmind/Counsel-27B: direct link, hf CLI and curl.
- Browser
- Download file 2.09 kB
-
https://huggingface.co/judicialmind/Counsel-27B/resolve/main/runtime/smoke_api.py
- Command line
-
hf download hf://judicialmind/Counsel-27B/runtime/smoke_api.py
-
curl -L -o smoke_api.py https://huggingface.co/judicialmind/Counsel-27B/resolve/main/runtime/smoke_api.py
2.09 kB
| """API smoke test against a running Counsel server: identity, thinking split, direct mode, tool call. | |
| usage: python smoke_api.py [base_url] [model] | |
| """ | |
| import json | |
| import sys | |
| import urllib.request | |
| URL = sys.argv[1] if len(sys.argv) > 1 else "http://127.0.0.1:8000/v1" | |
| MODEL = sys.argv[2] if len(sys.argv) > 2 else "counsel-27b" | |
| def chat(messages, **kw): | |
| body = {"model": MODEL, "messages": messages, "max_tokens": 4096, "temperature": 0.6} | kw | |
| req = urllib.request.Request(URL + "/chat/completions", json.dumps(body).encode(), {"Content-Type": "application/json"}) | |
| return json.load(urllib.request.urlopen(req, timeout=900))["choices"][0] | |
| ok = True | |
| c = chat([{"role": "user", "content": "Who are you and who built you? One sentence."}], | |
| chat_template_kwargs={"enable_thinking": False}) | |
| ans = c["message"]["content"] | |
| print("identity:", ans.strip()[:200]) | |
| ok &= "Counsel" in ans and "Qwen" not in ans | |
| c = chat([{"role": "user", "content": "Is a 'condition' or a 'warranty' breach grounds to terminate a contract under English law? Two sentences."}], | |
| chat_template_kwargs={"enable_thinking": True, "reasoning_effort": "low"}) | |
| r, a = c["message"].get("reasoning_content") or c["message"].get("reasoning") or "", c["message"]["content"] or "" | |
| print(f"thinking: reasoning {len(r)} chars, answer: {a.strip()[:200]}") | |
| ok &= len(r) > 0 and len(a) > 0 and "<think>" not in a | |
| tools = [{"type": "function", "function": {"name": "search_documents", "description": "Full-text search over the matter's documents.", | |
| "parameters": {"type": "object", "properties": {"query": {"type": "string"}}, "required": ["query"]}}}] | |
| c = chat([{"role": "user", "content": "Find every termination-for-convenience clause in the supply agreements."}], tools=tools, | |
| chat_template_kwargs={"enable_thinking": False}) | |
| calls = c["message"].get("tool_calls") or [] | |
| print("tool call:", [(t["function"]["name"], t["function"]["arguments"]) for t in calls]) | |
| ok &= bool(calls) and calls[0]["function"]["name"] == "search_documents" | |
| print("API_SMOKE", "PASS" if ok else "FAIL") | |