Same prompt to zephyr-chat provides different results from two interfaces. What is the difference?
- Zephyr Chat - a Hugging Face Space by HuggingFaceH4
- mhfvo6ltumj390xu.us-east-1.aws.endpoints.huggingface.cloud – end point created on HuggingFace
Is the prompt templates? Is the difference in inference module? Please assist!
Prompt is given in the python code below.
Response from Zephyr Chat - a Hugging Face Space by HuggingFaceH4 - Correct
Query 1:
SELECT * FROM spirit WHERE type=‘wine’ AND subtype=‘red wine’ AND country=‘Italy’ AND cost > 20;
Query 2:
SELECT * FROM spirit WHERE type=‘wine’ AND subtype=‘white wine’ AND region=‘Ontario’ AND cost < 20;
Response from HF Endpoint using Python code - Incorrect
[{‘generated_text’: ‘What are all the tequilas which are over $30 and are made in Mexico.’}]
Python Code to interface with HF endpoint:
import requests
API_URL = “end pont URL”
headers = {
“Authorization”: “Bearer…t”,
“Content-Type”: “application/json”
}
def query(payload):
response = requests.post(API_URL, headers=headers, json=payload)
return response.json()
“”"output = query({
“inputs”: {
“past_user_inputs”: [“Which movie is the best ?”],
“generated_responses”: [“It is Die Hard for sure.”],
“text”: “Can you explain why ?”
},
})“”"
output = query({
“inputs”:
“”"From the query you create SQL. Below the is database schema
Table Spirit has following columns:
ID
Name
Brand
Size: 750ml | 1 L | 1.2L
Type: Wine | Spirit
Subtype – See below
Variety: Chardonnay | Merlot | Cabernet Sauvignon
Vintage: True | False
ABV
Region
Country
Price
Food Paring
On Special
Recipes: Names of recipes.
Image URL
Here are example query and their converted SQL:
Query 1: What are the red wines which are made in Ontario and are less than $15
SQL 1: select * from spirit where type = “wine” and subtype = “red wine” and region = “ontario” and cost <= 15
Query 1: What are the white wines which you would suggest me with filet minion?
SQL 1: select * from spirit where type = “wine” and subtype = “white wine” and food_pair = “filet minion”;
Please generate only SQL for the following queries:
What are all the red wines which are grown in Italy and are over $20.
What are all the white wines which are grown in ontario and are less than $20.
“”",
})
print(output)