Instructions to use srini98/mistral-function-calling with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use srini98/mistral-function-calling with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="srini98/mistral-function-calling")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("srini98/mistral-function-calling") model = AutoModelForCausalLM.from_pretrained("srini98/mistral-function-calling") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use srini98/mistral-function-calling with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "srini98/mistral-function-calling" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "srini98/mistral-function-calling", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/srini98/mistral-function-calling
- SGLang
How to use srini98/mistral-function-calling 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 "srini98/mistral-function-calling" \ --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": "srini98/mistral-function-calling", "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 "srini98/mistral-function-calling" \ --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": "srini98/mistral-function-calling", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use srini98/mistral-function-calling with Docker Model Runner:
docker model run hf.co/srini98/mistral-function-calling
Update README.md
Browse files
README.md
CHANGED
|
@@ -14,3 +14,37 @@ For training , inference and evalaution kindly check this repository:
|
|
| 14 |
|
| 15 |
https://github.com/Srini-98/Function-Calling-Using-Mistral
|
| 16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
https://github.com/Srini-98/Function-Calling-Using-Mistral
|
| 16 |
|
| 17 |
+
Use the following prompt format
|
| 18 |
+
```
|
| 19 |
+
SYSTEM: You are a helpful assistant with access to the following functions. Use them if required -
|
| 20 |
+
{
|
| 21 |
+
"name": "function_name",
|
| 22 |
+
"description": "description",
|
| 23 |
+
"parameters": {
|
| 24 |
+
"type": "object",
|
| 25 |
+
"properties": {
|
| 26 |
+
"param_name1": {
|
| 27 |
+
"type": "string",
|
| 28 |
+
"description": "description of param"
|
| 29 |
+
},
|
| 30 |
+
"param_name2": {
|
| 31 |
+
"type": "string",
|
| 32 |
+
"description": "description of param"
|
| 33 |
+
},
|
| 34 |
+
"param_name3":{
|
| 35 |
+
"type: "string",
|
| 36 |
+
"description" : "description of param"
|
| 37 |
+
}
|
| 38 |
+
},
|
| 39 |
+
"required": [
|
| 40 |
+
"param_name1",
|
| 41 |
+
]
|
| 42 |
+
}
|
| 43 |
+
}
|
| 44 |
+
USER: {question here}
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
ASSISTANT: {model answer} <|endoftext|>
|
| 48 |
+
```
|
| 49 |
+
|
| 50 |
+
The answer generation can be stopped with the <|endoftext|> token. You can add multiple functions as well and set param names. "Required" field forces model to always call that param.
|