ollama / ollama/ollama-python

json format do not return all the results

Open
#94 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
10.5k
Forks
1.2k
Avg merge
4m
Merged PRs (30d)
1

Description

The code is below and problem i met is below:

code = """

package org.demo.codesmell.config;

public class AppConfig {

public static final String APP_PASSWORD = "appPassword";

public static final String Password = "password";
}

"""
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:

  1. The naming convention for constants is not consistent. Some constants are in all caps, while others are camelCase. It's best to use a consistent naming convention throughout the code.
  2. The Password constant is misspelled. It should be APP_PASSWORD.
  3. The APP_PASSWORD constant is not used anywhere in the code. If it's not being used, it can be removed.
  4. There are no getters or setters for the constants. It's best to provide getters and setters for each constant so that they can be accessed and modified from outside the class.
  5. The class is not final, which means it can be extended. However, there is no need to extend this class as it only contains constants. It would be better to make the class final to prevent unintended inheritance.

But, as I just use the option, format="json", it just return 2 issues in json format, is that a bug?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the reproduction script in the issue and compare the ollama.chat calls with and without format="json", using the same prompt and model settings. The issue names no repository files or tests; done means establishing whether JSON formatting is expected to change the number of reported issues and documenting or reproducing the confirmed behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
json, ollama, python
Domain
ai, api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.