mirror of
https://github.com/ollama/ollama-python.git
synced 2026-08-20 11:49:52 +00:00
add infill example
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
from ollama import generate
|
||||
|
||||
prefix = '''def remove_non_ascii(s: str) -> str:
|
||||
""" '''
|
||||
|
||||
suffix = '''
|
||||
return result
|
||||
'''
|
||||
|
||||
|
||||
response = generate(
|
||||
model='codellama:7b-code',
|
||||
prompt=f'<PRE> {prefix} <SUF>{suffix} <MID>',
|
||||
options={
|
||||
'num_predict': 128,
|
||||
'temperature': 0,
|
||||
'top_p': 0.9,
|
||||
'stop': ['<EOT>'],
|
||||
},
|
||||
)
|
||||
|
||||
print(response['response'])
|
||||
Reference in New Issue
Block a user