Instructions to use sharp-pixel/opensearch-agentic-dsl with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use sharp-pixel/opensearch-agentic-dsl with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("mistralai/Ministral-3-8B-Instruct-2512-BF16") model = PeftModel.from_pretrained(base_model, "sharp-pixel/opensearch-agentic-dsl") - Transformers
How to use sharp-pixel/opensearch-agentic-dsl with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="sharp-pixel/opensearch-agentic-dsl")# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("sharp-pixel/opensearch-agentic-dsl", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use sharp-pixel/opensearch-agentic-dsl with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "sharp-pixel/opensearch-agentic-dsl" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "sharp-pixel/opensearch-agentic-dsl", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/sharp-pixel/opensearch-agentic-dsl
- SGLang
How to use sharp-pixel/opensearch-agentic-dsl 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 "sharp-pixel/opensearch-agentic-dsl" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "sharp-pixel/opensearch-agentic-dsl", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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 "sharp-pixel/opensearch-agentic-dsl" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "sharp-pixel/opensearch-agentic-dsl", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use sharp-pixel/opensearch-agentic-dsl with Docker Model Runner:
docker model run hf.co/sharp-pixel/opensearch-agentic-dsl
opensearch-agentic-dsl
A LoRA adapter that translates English shopper requests into OpenSearch DSL for
a second-hand luxury catalog. It is designed for OpenSearch's native Agentic
Search QueryPlanningTool.
The adapter uses
mistralai/Ministral-3-8B-Instruct-2512-BF16
at revision 06cc81bfd6e45321d8fc8f816576c5b6ac67ec22. Load both the base
model and tokenizer at this revision, then attach the adapter with PEFT.
Input and output
Input combines shopper text, trusted application controls, the index mapping, and allowed query fields. The exact system prompt and user template are included. The complete example shows how to construct the three-line question and double JSON encode the mapping and field list.
Output is one JSON request body containing size, integer track_total_hits,
query, and optional sort. The planner applies required filters, price
ceilings, and the selected ranking mode. Persona expansion contributes optional
scoring. Index selection, search pipelines, and _source stay application-owned.
Run the model
Download sharp-pixel/opensearch-agentic-dsl and run the included example:
hf download sharp-pixel/opensearch-agentic-dsl --local-dir opensearch-agentic-dsl
cd opensearch-agentic-dsl
python example.py
The example requires a CUDA GPU with enough memory for the BF16 base model and
uses Transformers 5.13.0, PEFT 0.19.1, and PyTorch 2.13.0. It loads the bundled
prompts and local adapter, uses greedy decoding, and prints the generated body.
Set ADAPTER_ID=sharp-pixel/opensearch-agentic-dsl to load the adapter from the
Hub instead.
For vLLM, enable LoRA with maximum rank 16, load the language model only, and
serve the adapter as opensearch-agentic-dsl.
Training and evaluation
Training used 4,640 synthetic examples and 1,160 held-out examples, grouped to keep related scenarios within a single split. Only the language-model attention and MLP projections were adapted; the vision encoder and projector stayed frozen.
| Setting | Value |
|---|---|
| Method | QLoRA with completion-only supervision |
| Quantization / compute | 4-bit NF4 / BF16 |
| LoRA rank / alpha / dropout | 16 / 32 / 0.05 |
| Epochs / sequence length | 2 / 2,112 tokens |
| Learning rate / effective batch size | 0.0001 / 16 |
| GPU / training time | RTX PRO 6000 Blackwell / 1.76 hours |
| Metric | Value |
|---|---|
| Training loss | 0.0038393672 |
| Held-out loss | 0.0016606329 |
| Held-out token accuracy | 99.9305% |
Token accuracy is measured with teacher-forced targets, not freely generated requests. The synthetic evaluation does not establish real-world retrieval quality. Validate generated DSL against the actual mapping and application policy, and enforce OpenSearch permissions and resource limits.
Training data, prompts, policy, and the dependency lockfile match this verified source revision.
License
The adapter and accompanying model-card documentation are released under Apache 2.0. The upstream model and tokenizer are also Apache 2.0; see NOTICE for attribution. Application source and training data retain their respective licenses.
- Downloads last month
- -
Model tree for sharp-pixel/opensearch-agentic-dsl
Base model
mistralai/Ministral-3-8B-Base-2512