Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
ollama
Commits
07a4c1e3
Unverified
Commit
07a4c1e3
authored
Jul 10, 2023
by
Bruce MacDonald
Committed by
GitHub
Jul 10, 2023
Browse files
take all args as one prompt
parents
20dae6b3
4d8b0414
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
12 deletions
+11
-12
README.md
README.md
+8
-0
cmd/cmd.go
cmd/cmd.go
+3
-12
No files found.
README.md
View file @
07a4c1e3
...
...
@@ -48,6 +48,14 @@ Get a helping hand.
ollama run orca "Write an email to my boss."
```
### 🔎 Ask questions about documents
Send the contents of a document and ask questions about it.
```
ollama run nous-hermes "$(cat input.txt)", please summarize this story
```
### 📖 Storytelling
Venture into the unknown.
...
...
cmd/cmd.go
View file @
07a4c1e3
...
...
@@ -64,8 +64,10 @@ func pull(model string) error {
}
func
RunGenerate
(
_
*
cobra
.
Command
,
args
[]
string
)
error
{
// join all args into a single prompt
prompt
:=
strings
.
Join
(
args
[
1
:
],
" "
)
if
len
(
args
)
>
1
{
return
generate
Oneshot
(
args
[
0
],
args
[
1
:
]
...
)
return
generate
(
args
[
0
],
prompt
)
}
if
term
.
IsTerminal
(
int
(
os
.
Stdin
.
Fd
()))
{
...
...
@@ -114,17 +116,6 @@ func generate(model, prompt string) error {
return
nil
}
func
generateOneshot
(
model
string
,
prompts
...
string
)
error
{
for
_
,
prompt
:=
range
prompts
{
fmt
.
Printf
(
">>> %s
\n
"
,
prompt
)
if
err
:=
generate
(
model
,
prompt
);
err
!=
nil
{
return
err
}
}
return
nil
}
func
generateInteractive
(
model
string
)
error
{
fmt
.
Print
(
">>> "
)
scanner
:=
bufio
.
NewScanner
(
os
.
Stdin
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment