Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
evoprompt
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Grießhaber Daniel
evoprompt
Commits
331a4901
Commit
331a4901
authored
7 months ago
by
Grießhaber Daniel
Browse files
Options
Downloads
Patches
Plain Diff
simplify history handling in `ChatModel.create_completion`
parent
a78c704c
No related branches found
Branches containing commit
No related tags found
2 merge requests
!2
remove is_chat argument
,
!1
Refactor models
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
evoprompt/models.py
+3
-6
3 additions, 6 deletions
evoprompt/models.py
with
3 additions
and
6 deletions
evoprompt/models.py
+
3
−
6
View file @
331a4901
...
...
@@ -281,11 +281,8 @@ class ChatModel:
# a history is prepended to the messages, and we assume that it also includes a system message, i.e., we never add a system message in this case
# TODO is it better to check for a system message in the history?
if
history
is
not
None
:
messages
=
history
+
messages
[
messages
.
insert
(
index
,
entry
)
for
index
,
entry
in
enumerate
(
history
)]
elif
system_message
:
messages
=
[
self
.
_get_system_message
(
system_message
)]
+
messages
if
history
is
None
and
system_message
:
history
=
[
self
.
_get_system_message
(
system_message
)]
reponse
,
usage
=
self
.
_create_completion
(
messages
=
messages
,
...
...
@@ -296,7 +293,7 @@ class ChatModel:
)
messages
.
append
(
self
.
_get_assistant_message
(
reponse
))
return
reponse
,
messages
,
usage
return
reponse
,
history
+
messages
,
usage
class
LlamaChat
(
Llama
,
ChatModel
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment