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 #21 from dabumana/v.0.1.8
Browse files Browse the repository at this point in the history
v.0.1.8

Change Log:

* Log service updated
* Predict log added
* Minor improvements
* Removed unused code
* Layout service updated
  • Loading branch information
dabumana committed Apr 6, 2023
2 parents 80f9e8c + bde4493 commit 24eb1f1
Show file tree
Hide file tree
Showing 13 changed files with 239 additions and 204 deletions.
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ require (
github.com/cpuguy83/go-md2man/v2 v2.0.0 // indirect
github.com/derekparker/trie v0.0.0-20200317170641-1fdf38b7b0e9 // indirect
github.com/gdamore/encoding v1.0.0 // indirect
github.com/gdamore/tcell v1.4.0 // indirect
github.com/go-delve/delve v1.20.1 // indirect
github.com/go-delve/liner v1.2.3-0.20220127212407-d32d89dd2a5d // indirect
github.com/google/go-dap v0.6.0 // indirect
Expand All @@ -26,6 +27,7 @@ require (
github.com/mattn/go-colorable v0.0.9 // indirect
github.com/mattn/go-isatty v0.0.3 // indirect
github.com/mattn/go-runewidth v0.0.13 // indirect
github.com/mitchellh/go-wordwrap v1.0.1 // indirect
github.com/rivo/uniseg v0.4.2 // indirect
github.com/russross/blackfriday/v2 v2.0.1 // indirect
github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect
Expand Down
7 changes: 7 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ github.com/frankban/quicktest v1.11.3/go.mod h1:wRf/ReqHper53s+kmmSZizM8NamnL3IM
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/gdamore/encoding v1.0.0 h1:+7OoQ1Bc6eTm5niUzBa0Ctsh6JbMW6Ra+YNuAtDBdko=
github.com/gdamore/encoding v1.0.0/go.mod h1:alR0ol34c49FCSBLjhosxzcPHQbf2trDkoo5dl+VrEg=
github.com/gdamore/tcell v1.4.0 h1:vUnHwJRvcPQa3tzi+0QI4U9JINXYJlOz9yiaiPQ2wMU=
github.com/gdamore/tcell v1.4.0/go.mod h1:vxEiSDZdW3L+Uhjii9c3375IlDmR05bzxY404ZVSMo0=
github.com/gdamore/tcell/v2 v2.4.1-0.20210905002822-f057f0a857a1 h1:QqwPZCwh/k1uYqq6uXSb9TRDhTkfQbO80v8zhnIe5zM=
github.com/gdamore/tcell/v2 v2.4.1-0.20210905002822-f057f0a857a1/go.mod h1:Az6Jt+M5idSED2YPGtwnfJV0kXohgdCBPmHGSYc1r04=
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
Expand Down Expand Up @@ -155,6 +157,7 @@ github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORN
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/lucasb-eyer/go-colorful v1.0.3/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0=
github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY=
github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0=
github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
Expand All @@ -163,6 +166,7 @@ github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaO
github.com/mattn/go-isatty v0.0.3 h1:ns/ykhmWi7G9O+8a448SecJU3nSMBXJfqQkl0upE1jI=
github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
github.com/mattn/go-runewidth v0.0.3/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
github.com/mattn/go-runewidth v0.0.7/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
github.com/mattn/go-runewidth v0.0.13 h1:lTGmDsbAYt5DmK6OnoV7EuIF1wEIFAcxld6ypU4OSgU=
github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
Expand All @@ -172,6 +176,8 @@ github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceT
github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI=
github.com/mitchellh/go-wordwrap v1.0.1 h1:TLuKupo69TCn6TQSyGxwI1EblZZEsQ0vMlAFQflz0v0=
github.com/mitchellh/go-wordwrap v1.0.1/go.mod h1:R62XHJLzvMFRBbcrT7m7WgmE1eOyTSsCt+hzestvNj0=
github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg=
github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY=
github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
Expand Down Expand Up @@ -323,6 +329,7 @@ golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190626150813-e07cf5db2756/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
Expand Down
2 changes: 1 addition & 1 deletion handler/requester.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

// IServiceRequester - Service requester interface API
type IServiceRequester interface {
Start(sandboxMode bool)
Start()
}

// Node - Global node service for handler
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ import "caos/handler"
func main() {
// Use the service requester interface to initialize node component
var hn handler.IServiceRequester = handler.Node
hn.Start(false)
hn.Start()
}
5 changes: 3 additions & 2 deletions model/historical.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ package model

// HistoricalPrompt - historical prompt
type HistoricalPrompt struct {
Header EngineProperties `json:"properties"`
Body PromptProperties `json:"body"`
Header EngineProperties `json:"properties"`
Body PromptProperties `json:"parameters"`
PredictiveBody PredictProperties `json:"predictivity"`
}

// HistoricalEvent - Session historical event
Expand Down
24 changes: 12 additions & 12 deletions model/predict.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,10 @@ package model

// PredictProperties - Request model
type PredictProperties struct {
Input []string `json:"input"`
Input []string `json:"context"`
Details PredictResponse `json:"details"`
}

// PredictRequest - Request model
type PredictRequest struct {
Document string `json:"document"`
}

// PredictResponse - Response model
type PredictResponse struct {
Documents []Predict `json:"documents"`
Expand All @@ -22,20 +17,25 @@ type Predict struct {
AverageProb float64 `json:"average_generated_prob"`
CompletelyProb float64 `json:"completely_generated_prob"`
OverallBurstiness float64 `json:"overall_burstiness"`
Paragraphs []Paragraph `json:"paragraphs"`
Sentences []Sentence `json:"sentences"`
Paragraphs []Paragraph `json:"paragraphs"`
}

// Sentence - Nested sentence model
type Sentence struct {
GeneratedProb int `json:"generated_prob"`
Perplexity int `json:"perplexity"`
Sentence string `json:"sentence"`
Sentence string `json:"sentence"`
Perplexity float64 `json:"perplexity"`
GeneratedProb float64 `json:"generated_prob"`
}

// Paragraph - Nested paragraphs model
type Paragraph struct {
CompletelyProb float64 `json:"completely_generated_prob"`
NumberSentences int `json:"num_sentences"`
Index int `json:"start_sentence_index"`
NumberSentences int `json:"num_sentences"`
CompletelyProb float64 `json:"completely_generated_prob"`
}

// PredictRequest - Request model
type PredictRequest struct {
Document string `json:"document"`
}
6 changes: 3 additions & 3 deletions service/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func (c Agent) Initialize() Agent {
// ID
c.id = "anon"
// Key
c.key = c.GetKeyFromLocal()
c.key = c.getKeyFromLocal()
// Role
c.preferences.Role = model.Assistant
// Background context
Expand Down Expand Up @@ -84,8 +84,8 @@ func (c Agent) Connect() (gpt3.Client, *http.Client) {
return c.client, c.exClient
}

// GetKeyFromVault - Get the currect key stablished on the environment
func (c Agent) GetKeyFromLocal() string {
// getKeyFromVault - Get the currect key stablished on the environment
func (c Agent) getKeyFromLocal() string {
apiKey := os.Getenv("API_KEY")
return apiKey
}
Expand Down
16 changes: 9 additions & 7 deletions service/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func (c Controller) EditRequest() {
event.VisualLogEdit(resp)
}

event.LogEngine(node.controller.currentAgent)
event.LogEngine(c.currentAgent)
}

// ChatCompletionRequest - Chat completion request to send task prompt
Expand All @@ -48,7 +48,7 @@ func (c Controller) ChatCompletionRequest() {
event.VisualLogChatCompletion(nil, cresp)
}

event.LogEngine(node.controller.currentAgent)
event.LogEngine(c.currentAgent)
}

// CompletionRequest - Start completion request to send task prompt
Expand All @@ -66,7 +66,7 @@ func (c Controller) CompletionRequest() {
event.VisualLogCompletion(resp)
}

event.LogEngine(node.controller.currentAgent)
event.LogEngine(c.currentAgent)
}

// EmbeddingRequest - Start a embedding vector request
Expand All @@ -79,7 +79,7 @@ func (c Controller) EmbeddingRequest() {
event.VisualLogEmbedding(resp)
}

event.LogEngine(node.controller.currentAgent)
event.LogEngine(c.currentAgent)
}

// PredictableRequest - Start a predictable string request
Expand All @@ -88,16 +88,18 @@ func (c Controller) PredictableRequest() {

var event EventManager
if resp != nil {
event.LogPredict(node.controller.currentAgent.engineProperties, node.controller.currentAgent.promptProperties, &node.controller.currentAgent.predictProperties, resp)
event.LogPredict(node.controller.currentAgent.engineProperties, node.controller.currentAgent.predictProperties, resp)
event.VisualLogPredict(resp)

c.currentAgent.predictProperties.Details.Documents = append(c.currentAgent.predictProperties.Details.Documents, resp.Documents...)
}

event.LogPredictEngine(node.controller.currentAgent)
event.LogPredictEngine(c.currentAgent)
}

// ListModels - Get actual models available
func (c Controller) ListModels() {
resp := node.prompt.GetListModels(node.controller.currentAgent)
resp := node.prompt.GetListModels(c.currentAgent)
if resp != nil {
for _, i := range resp.Data {
node.controller.currentAgent.preferences.Models = append(node.controller.currentAgent.preferences.Models, i.ID)
Expand Down

0 comments on commit 24eb1f1

Please sign in to comment.