add format
to example python client
This commit is contained in:
parent
afa61bdf45
commit
cdddd3df65
1 changed files with 3 additions and 2 deletions
|
@ -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.
|
# 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 final response object will include statistics and additional data from the request. Use the callback function to override
|
||||||
# the default handler.
|
# 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:
|
try:
|
||||||
url = f"{BASE_URL}/api/generate"
|
url = f"{BASE_URL}/api/generate"
|
||||||
payload = {
|
payload = {
|
||||||
|
@ -16,7 +16,8 @@ def generate(model_name, prompt, system=None, template=None, context=None, optio
|
||||||
"system": system,
|
"system": system,
|
||||||
"template": template,
|
"template": template,
|
||||||
"context": context,
|
"context": context,
|
||||||
"options": options
|
"options": options,
|
||||||
|
"format": format,
|
||||||
}
|
}
|
||||||
|
|
||||||
# Remove keys with None values
|
# Remove keys with None values
|
||||||
|
|
Loading…
Reference in a new issue