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
ad25c5a5
Commit
ad25c5a5
authored
7 months ago
by
Grießhaber Daniel
Browse files
Options
Downloads
Patches
Plain Diff
remove OpenAI (non-chat) model
parent
33f58a73
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
+6
-36
6 additions, 36 deletions
evoprompt/models.py
with
6 additions
and
36 deletions
evoprompt/models.py
+
6
−
36
View file @
ad25c5a5
...
...
@@ -300,7 +300,7 @@ class LlamaChat(Llama):
return
{
"
messages
"
:
messages
},
messages
class
OpenA
I
(
LLMModel
):
class
OpenA
iChat
(
LLMModel
):
"""
Queries an OpenAI model using its API.
"""
def
__init__
(
...
...
@@ -314,41 +314,6 @@ class OpenAI(LLMModel):
super
().
__init__
(
options
,
**
kwargs
)
def
_create_completion
(
self
,
use_cache
:
bool
=
False
,
**
kwargs
,
):
response
=
self
.
_call_model
(
self
.
openai_client
.
completions
.
create
,
model
=
self
.
model
,
use_cache
=
use_cache
,
**
kwargs
,
)
response_text
=
response
.
choices
[
0
].
text
usage
=
ModelUsage
(
**
response
.
usage
.
__dict__
)
return
response_text
,
usage
def
build_model_input
(
self
,
prompt
:
str
,
system_message
:
str
|
None
,
messages
:
list
[
dict
[
str
,
str
]],
history
:
list
[
dict
[
str
,
str
]]
|
None
=
None
,
):
if
system_message
is
not
None
:
prompt
=
system_message
+
prompt
return
{
"
prompt
"
:
prompt
},
messages
@classmethod
def
register_arguments
(
cls
,
parser
:
ArgumentParser
):
group
=
parser
.
add_argument_group
(
"
OpenAI model arguments
"
)
group
.
add_argument
(
"
--openai-model
"
,
"
-m
"
,
type
=
str
,
default
=
"
gpt-3.5-turbo
"
)
class
OpenAiChat
(
OpenAI
):
def
_create_completion
(
self
,
use_cache
:
bool
=
False
,
...
...
@@ -382,6 +347,11 @@ class OpenAiChat(OpenAI):
return
{
"
messages
"
:
messages
},
messages
@classmethod
def
register_arguments
(
cls
,
parser
:
ArgumentParser
):
group
=
parser
.
add_argument_group
(
"
OpenAI model arguments
"
)
group
.
add_argument
(
"
--openai-model
"
,
"
-m
"
,
type
=
str
,
default
=
"
gpt-3.5-turbo
"
)
argument_group
=
argument_parser
.
add_argument_group
(
"
Model arguments
"
)
argument_group
.
add_argument
(
...
...
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