mirror of
https://github.com/ollama/ollama-python.git
synced 2026-07-21 09:05:23 -04:00
json format do not return all the results #57
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @jojogh on GitHub (Mar 20, 2024).
The code is below and problem i met is below:
code = """
"""
prompt = f"""
Please review the following code, and you must find all the issues in the code:{code}"""
import ollama #ollama run codellama:34b-instruct-q5_K_M
from ollama import Options
response = ollama.chat(model='codellama:34b-instruct-q5_K_M',
messages=[
{
'role': 'user',
'content': prompt,
},
],
#format="json",
#stream=True,
options=Options(
temperature=0,
#top_p=0.9,
#max_tokens=1024,
num_ctx=8192,
num_predict=-1)
)
print(response['message']["content"])
It will return the following informations, 5 issues
The code you provided is a Java class that defines some constants for an application configuration. Here are the issues I found:
Passwordconstant is misspelled. It should beAPP_PASSWORD.APP_PASSWORDconstant is not used anywhere in the code. If it's not being used, it can be removed.But, as I just use the option, format="json", it just return 2 issues in json format, is that a bug?
@gautam-fairpe commented on GitHub (Apr 13, 2024):
No, It is not a bug. When you force model to return in specified json format, result will not be as good as normal generation.
@gautam-fairpe commented on GitHub (Apr 13, 2024):
I faced similar issue while using llama cpp python with lm-format-enforcer.
https://github.com/noamgat/lm-format-enforcer#:~:text=Diagnostics%20%2D%20Will%20I%20always%20get%20good%20results%3F