example.py
1 from mlflow.deployments import get_deploy_client 2 3 4 def main(): 5 client = get_deploy_client("http://localhost:7000") 6 7 print(f"Mistral endpoints: {client.list_endpoints()}\n") 8 print(f"Mistral completions endpoint info: {client.get_endpoint(endpoint='completions')}\n") 9 10 # Completions request 11 response_completions = client.predict( 12 endpoint="completions", 13 inputs={ 14 "prompt": "How many average size European ferrets can fit inside a standard olympic?", 15 "temperature": 0.1, 16 }, 17 ) 18 print(f"Mistral response for completions: {response_completions}") 19 20 # Embeddings request 21 response_embeddings = client.predict( 22 endpoint="embeddings", 23 inputs={ 24 "input": [ 25 "How does your culture celebrate the New Year, and how does it differ from other countries' " 26 "celebrations?" 27 ] 28 }, 29 ) 30 print(f"Mistral response for embeddings: {response_embeddings}") 31 32 33 if __name__ == "__main__": 34 main()