Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
APIChatGPT
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SIGNORELLI Lucas
APIChatGPT
Commits
6fbf703c
Commit
6fbf703c
authored
2 years ago
by
WISSLE Guillaume
Browse files
Options
Downloads
Patches
Plain Diff
Delete OpenAIClient.php
parent
8d62939b
No related branches found
No related tags found
No related merge requests found
Pipeline
#10910
passed
2 years ago
Stage: build
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
OpenAIClient.php
+0
-69
0 additions, 69 deletions
OpenAIClient.php
with
0 additions
and
69 deletions
OpenAIClient.php
deleted
100644 → 0
+
0
−
69
View file @
8d62939b
<?php
class
OpenAIClient
{
private
string
$question
;
private
string
$code
;
private
string
$test
;
public
function
__construct
(
string
$question
)
{
$this
->
question
=
$question
;
$this
->
code
=
$this
->
genCode
();
$this
->
test
=
$this
->
genTest
();
}
public
function
genCode
():
string
{
$client
=
OpenAI
::
client
(
'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'
);
$result
=
$client
->
completions
()
->
create
([
'model'
=>
'text-davinci-003'
,
'prompt'
=>
$this
->
question
,
]);
return
$result
[
'choices'
][
0
][
'text'
];
}
public
function
genTest
():
string
{
$client
=
OpenAI
::
client
(
'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'
);
$result
=
$client
->
completions
()
->
create
([
'model'
=>
'text-davinci-003'
,
'prompt'
=>
$this
->
question
,
]);
return
$result
[
'choices'
][
0
][
'text'
];
}
public
function
getQuestion
():
string
{
return
$this
->
question
;
}
public
function
setQuestion
(
string
$question
):
void
{
$this
->
question
=
$question
;
}
public
function
getCode
():
string
{
return
$this
->
code
;
}
public
function
setCode
(
string
$code
):
void
{
$this
->
code
=
$code
;
}
public
function
getTest
():
string
{
return
$this
->
test
;
}
public
function
setTest
(
string
$test
):
void
{
$this
->
test
=
$test
;
}
}
\ No newline at end of file
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