mirror of
https://github.com/ollama/ollama-python.git
synced 2026-01-13 21:57:16 +08:00
* Examples and README updates --------- Co-authored-by: fujitatomoya <tomoya.fujita825@gmail.com> Co-authored-by: Michael Yang <mxyng@pm.me>
23 lines
346 B
Python
23 lines
346 B
Python
from ollama import generate
|
|
|
|
prompt = '''def remove_non_ascii(s: str) -> str:
|
|
""" '''
|
|
|
|
suffix = """
|
|
return result
|
|
"""
|
|
|
|
response = generate(
|
|
model='codellama:7b-code',
|
|
prompt=prompt,
|
|
suffix=suffix,
|
|
options={
|
|
'num_predict': 128,
|
|
'temperature': 0,
|
|
'top_p': 0.9,
|
|
'stop': ['<EOT>'],
|
|
},
|
|
)
|
|
|
|
print(response['response'])
|