From cdddd3df6521b140aa18670e7c641d9a1f6c22ba Mon Sep 17 00:00:00 2001 From: Jeffrey Morgan Date: Fri, 10 Nov 2023 10:22:21 -0800 Subject: [PATCH] add `format` to example python client --- api/client.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/api/client.py b/api/client.py index aa4e3321..c5fbc9c2 100644 --- a/api/client.py +++ b/api/client.py @@ -7,7 +7,7 @@ BASE_URL = os.environ.get('OLLAMA_HOST', 'http://localhost:11434') # Generate a response for a given prompt with a provided model. This is a streaming endpoint, so will be a series of responses. # The final response object will include statistics and additional data from the request. Use the callback function to override # the default handler. -def generate(model_name, prompt, system=None, template=None, context=None, options=None, callback=None): +def generate(model_name, prompt, system=None, template=None, format="", context=None, options=None, callback=None): try: url = f"{BASE_URL}/api/generate" payload = { @@ -16,7 +16,8 @@ def generate(model_name, prompt, system=None, template=None, context=None, optio "system": system, "template": template, "context": context, - "options": options + "options": options, + "format": format, } # Remove keys with None values