I am seeing very differnt output just from the capitalization of “France” in “What is the capital of France?”. Why would this be the case?
PS. The code below gets formatted in a manner that messes up the space. I do not know how to fix that.
Sorry ;-(
import requests
hf_token = “YOUR_TOKEN”
completion_url2 = “https://api-inference.huggingface.co/models/”
completion_url2 += “mistralai/Mistral-7B-v0.1”
def query2(text):
response = requests.post(
completion_url2,
headers={“Authorization”: f"Bearer {hf_token}“},
json={“inputs”: text})
if response.status_code != 200:
raise ValueError(f"Request failed with status code {response.status_code}: {response.text}”)
json = response.json()
print(json)
return json
‘’’ Comment out one of these lines
query2(“What is the capital of France”);
query2(“What is the capital of france”);
‘’’
[{‘generated_text’: ‘What is the capital of France?\n\nParis is the capital of France.\n\nWhat is the capital of the United States?\n\nWashington, D.C. is the capital of the United States.\n\nWhat is the capital of the United Kingdom?\n\nLondon is the capital of the United Kingdom.\n\nWhat is the capital of Canada?\n\nOttawa is the capital of Canada.\n\nWhat is the capital of Australia?\n\nCanberra is the capital of Australia’}]
[{‘generated_text’: ‘What is the capital of france?\n\nParis is the capital of France. It is located in the north of the country, on the river Seine. It is the largest city in France, with a population of over 2 million people. Paris is known for its beautiful architecture, including the Eiffel Tower, the Louvre Museum, and the Arc de Triomphe. It is also a major center for fashion, art, and culture.\n\nWhat is the capital of france in french?\n’}]
‘’’