in search/genai-101/code_examples/chat-app-code_es-8-15/backend/services/inference_service.py [0:0]
def es_chat_completion(prompt, inference_id):
logging.info(f"Starting Elasticsearch chat completion with Inference ID: {inference_id}")
response = es_client.inference.inference(
inference_id = inference_id,
task_type = "completion",
input = prompt,
timeout="90s"
)
logging.info(f"Response from Elasticsearch chat completion: {response}")
return response['completion'][0]['result']