Skip to content

Commit

Permalink
add insert support to generate endpoint (#113)
Browse files Browse the repository at this point in the history
  • Loading branch information
BruceMacD authored Jul 17, 2024
1 parent 59ef1ce commit fcd418a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 15 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ ollama.generate(request)
- `request` `<Object>`: The request object containing generate parameters.
- `model` `<string>` The name of the model to use for the chat.
- `prompt` `<string>`: The prompt to send to the model.
- `suffix` `<string>`: (Optional) Suffix is the text that comes after the inserted text.
- `system` `<string>`: (Optional) Override the model system prompt.
- `template` `<string>`: (Optional) Override the model template.
- `raw` `<boolean>`: (Optional) Bypass the prompt template and pass the prompt directly to the model.
Expand Down
18 changes: 3 additions & 15 deletions examples/fill-in-middle/fill.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,8 @@
import ollama from 'ollama'

const prefix = `def remove_non_ascii(s: str) -> str:
"""
`
const suffix = `
return result
`
const response = await ollama.generate({
model: 'codellama:7b-code',
prompt: `<PRE> ${prefix} <SUF>${suffix} <MID>`,
options: {
num_predict: 128,
temperature: 0,
top_p: 0.9,
presence_penalty: 0,
stop: ['<EOT>'],
},
model: 'deepseek-coder-v2',
prompt: `def add(`,
suffix: `return c`,
})
console.log(response.response)
1 change: 1 addition & 0 deletions src/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export interface Options {
export interface GenerateRequest {
model: string
prompt: string
suffix?: string
system?: string
template?: string
context?: number[]
Expand Down

0 comments on commit fcd418a

Please sign in to comment.