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
76bc4d04
Commit
76bc4d04
authored
Dec 06, 2023
by
Matt Williams
Browse files
Cleanup as per Bruce
Signed-off-by:
Matt Williams
<
m@technovangelist.com
>
parent
aec742b6
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
examples/python-simplechat/client.py
examples/python-simplechat/client.py
+3
-3
No files found.
examples/python-simplechat/client.py
View file @
76bc4d04
...
@@ -15,6 +15,8 @@ def chat(messages):
...
@@ -15,6 +15,8 @@ def chat(messages):
for
line
in
r
.
iter_lines
():
for
line
in
r
.
iter_lines
():
body
=
json
.
loads
(
line
)
body
=
json
.
loads
(
line
)
if
"error"
in
body
:
raise
Exception
(
body
[
"error"
])
if
body
.
get
(
"done"
)
is
False
:
if
body
.
get
(
"done"
)
is
False
:
message
=
body
.
get
(
"message"
,
""
)
message
=
body
.
get
(
"message"
,
""
)
content
=
message
.
get
(
"content"
,
""
)
content
=
message
.
get
(
"content"
,
""
)
...
@@ -22,8 +24,6 @@ def chat(messages):
...
@@ -22,8 +24,6 @@ def chat(messages):
# the response streams one token at a time, print that as we receive it
# the response streams one token at a time, print that as we receive it
print
(
content
,
end
=
""
,
flush
=
True
)
print
(
content
,
end
=
""
,
flush
=
True
)
if
"error"
in
body
:
raise
Exception
(
body
[
"error"
])
if
body
.
get
(
"done"
,
False
):
if
body
.
get
(
"done"
,
False
):
message
[
"content"
]
=
output
message
[
"content"
]
=
output
...
@@ -32,7 +32,7 @@ def chat(messages):
...
@@ -32,7 +32,7 @@ def chat(messages):
def
main
():
def
main
():
messages
=
[]
messages
=
[]
)
# the context stores a conversation history, you can use this to make the model more context aware
while
True
:
while
True
:
user_input
=
input
(
"Enter a prompt: "
)
user_input
=
input
(
"Enter a prompt: "
)
print
()
print
()
...
...
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