Skip to content
This repository has been archived by the owner on Jan 21, 2024. It is now read-only.

Commit

Permalink
Merge pull request #30 from dabumana/developer
Browse files Browse the repository at this point in the history
Duplication hotfix
  • Loading branch information
dabumana committed Jul 11, 2023
2 parents 902a1e2 + 12e263c commit 1890e76
Show file tree
Hide file tree
Showing 4 changed files with 105 additions and 206 deletions.
9 changes: 6 additions & 3 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ build:
make -C ./src test
make -C ./src build APP=${APP} VERSION=${VERSION}

test:
make -C ./src test

clean:
make -C ./src clean

Expand All @@ -20,6 +17,12 @@ coverage:
run: build
make -C ./src run

test:
make -C ./src test

tidy:
make -C ./src tidy

vendor:
make -C ./src vendor

Expand Down
15 changes: 9 additions & 6 deletions src/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,6 @@ clean:
rm -rf 'rootCA.pem'
rm -rf 'coverage.out'

run:
./bin/${APP}-${VERSION}

test:
go test ./...

coverage:
go test -covermode=count -coverprofile coverage.out ${PKG_LIST}

Expand All @@ -33,5 +27,14 @@ env:
openssl req -x509 -new -nodes -key localCA.key -sha256 -days 1024 -out localCA.crt
openssl x509 -in localCA.crt -out localCA.pem -outform PEM

run:
./bin/${APP}-${VERSION}

test:
go test ./...

tidy:
go mod tidy

vendor:
go mod vendor
32 changes: 16 additions & 16 deletions src/test/agent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,22 @@ import (
"caos/service"
)

var agent = &service.Agent{}

var context = []string{"Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit..."}
var prompt = []string{"Extend the quote"}

const id = "test_user"
const role = model.Assistant
const temperature = 1.0
const topp = 0.4
const penalty = 0.5
const frequency = 0.5
const result = 4
const probabilities = 4

func TestInitialize(t *testing.T) {
t.Run("Initialize", func(t *testing.T) {
agent := &service.Agent{}

agent.Initialize()
preferences := agent.GetStatus()

Expand All @@ -28,14 +40,7 @@ func TestInitialize(t *testing.T) {

func TestSetEngineParameters(t *testing.T) {
t.Run("SetEngineParameters", func(t *testing.T) {
agent := &service.Agent{}
id := "test_user"
role := model.Assistant
model := "text-davinci-003"
temperature := 1.0
topp := 0.4
penalty := 0.5
frequency := 0.5
engineProperties := agent.SetEngineParameters(
id,
model,
Expand All @@ -44,6 +49,7 @@ func TestSetEngineParameters(t *testing.T) {
float32(topp),
float32(penalty),
float32(frequency))

if engineProperties.Model != model ||
engineProperties.Temperature != float32(temperature) ||
engineProperties.TopP != float32(topp) ||
Expand All @@ -64,16 +70,12 @@ func TestSetEngineParameters(t *testing.T) {

func TestSetPromptParameters(t *testing.T) {
t.Run("SetPromptParameters", func(t *testing.T) {
agent := &service.Agent{}
context := []string{"Generate an UML template"}
prompt := []string{"for an eshop, include customers and providers."}
result := 4
probabilities := 4
requestProperties := agent.SetPromptParameters(
context,
prompt,
result,
probabilities)

if requestProperties.Input == nil ||
requestProperties.Instruction == nil ||
requestProperties.Results != result ||
Expand All @@ -92,8 +94,6 @@ func TestSetPromptParameters(t *testing.T) {

func TestSetPredictionParameters(t *testing.T) {
t.Run("SetPredictionParameters", func(t *testing.T) {
agent := &service.Agent{}
context := []string{"Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit..."}
predictProperties := agent.SetPredictionParameters(context)
if predictProperties.Input == nil {
t.Errorf("Received:%v\nExpected:%v\n", predictProperties.Input, context)
Expand Down

0 comments on commit 1890e76

Please sign in to comment.