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 #15 from dabumana/v.0.1.2
Browse files Browse the repository at this point in the history
V.0.1.2
  • Loading branch information
dabumana committed Feb 6, 2023
2 parents 607b7ee + 93bd895 commit 806bbfb
Show file tree
Hide file tree
Showing 13 changed files with 56 additions and 371 deletions.
14 changes: 10 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,26 @@ Installation steps:
#### Edit>
- Contextual input

![console.gif](docs%2Fmedia%2Fedit.gif)

#### Embedded>
- Nested input to analize embeddings

![console.gif](docs%2Fmedia%2Fembedded.gif)

#### Predict>
- Nested input to analize text (Powered by GPTZero)

![console.gif](docs%2Fmedia%2Fzero.gif)

- Multiple results and probabilities

- Detailed log according to UTC

### How to use?

![console.gif](docs%2Fmedia%2Fgeneral.gif)

The OpenAI API provides access to a range of AI-powered services, including natural language processing (NLP), computer vision, and reinforcement learning.

- OpenAI API is a set of tools and services that allow developers to create applications that use artificial intelligence (AI) technology.
Expand All @@ -68,10 +76,10 @@ The OpenAI API provides access to a range of AI-powered services, including natu
The terminal app have a conversational assistant that is designed to work with OpenAI services, able to understand natural language queries and provide accurate results,
also includes advanced modes that allow users to modify the contextual information for specific uses for example, users can adjust the engine, results, probabilities according to the amount of words used in the query, this allows for more accurate results when using longer queries.

![console.gif](docs%2Fmedia%2Fconsole.gif)

#### General parameters:

![details.png](docs%2Fmedia%2Fdetails.png)

- **Mode**: Modify the actual mode, select between **(TEXT/EDIT/CODE)**
- **Engine**: Modify the model that you want to test
- **Results**: Modify the amount of results displayed for each prompt
Expand All @@ -88,8 +96,6 @@ also includes advanced modes that allow users to modify the contextual informati
- Press `New Conversation` and select `Edit mode` the first request will be for a completion endpoint the second based on the first request will continue editing the content in the parameters that you ask.
- **Conversational Mode**: Use conversational AI mode request for a friendly interaction.

![details.png](docs%2Fmedia%2Fdetails.png)

### Disclaimer :warning:

This software is provided "as is" and any expressed or implied warranties, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose are disclaimed. In no event shall the author or contributors be liable for any direct, indirect, incidental, special, exemplary, or consequential.
321 changes: 0 additions & 321 deletions caos.cast

This file was deleted.

Binary file removed docs/media/console.gif
Binary file not shown.
Binary file added docs/media/edit.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/media/embedded.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/media/general.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed docs/media/models.png
Binary file not shown.
Binary file added docs/media/zero.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions model/pool.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// Package model section
package model

// PoolProperties - Session pool management
type PoolProperties struct {
Event []HistoricalEvent `json:"events"`
Session []HistoricalSession `json:"sessions"`
TrainingEvent []HistoricalTrainingEvent `json:"training_events"`
TrainingSession []HistoricalTrainingSession `json:"training_sessions"`
}
15 changes: 8 additions & 7 deletions service/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (

"caos/model"
"caos/service/parameters"
"caos/util"

"github.com/PullRequestInc/go-gpt3"
"github.com/joho/godotenv"
Expand All @@ -32,15 +33,15 @@ func (c Agent) Initialize() Agent {
c.client, c.exClient = c.Connect()
// Global preferences
c.preferences.Engine = "text-davinci-003"
c.preferences.Frequency = 0.5
c.preferences.Penalty = 0.5
c.preferences.MaxTokens = 250
c.preferences.Frequency = util.ParseFloat32("\u0030\u002e\u0035")
c.preferences.Penalty = util.ParseFloat32("\u0030\u002e\u0035")
c.preferences.MaxTokens = util.ParseInt64("\u0032\u0035\u0030")
c.preferences.Mode = "Text"
c.preferences.Models = append(c.preferences.Models, "zero-gpt")
c.preferences.Probabilities = 1
c.preferences.Results = 1
c.preferences.Temperature = 0.4
c.preferences.Topp = 0.6
c.preferences.Probabilities = util.ParseInt32("\u0031")
c.preferences.Results = util.ParseInt32("\u0031")
c.preferences.Temperature = util.ParseFloat32("\u0030\u002e\u0034")
c.preferences.Topp = util.ParseFloat32("\u0030\u002e\u0036")
// Mode selection
c.preferences.IsConversational = false
c.preferences.IsEditable = false
Expand Down
24 changes: 15 additions & 9 deletions service/layout.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ func OnBack() {
node.layout.pages.HidePage("modal")
// Validate layout forms
ValidateRefinementForm()
// Clean input
if node.controller.currentAgent.preferences.Mode == "Edit" {
node.layout.promptInput.SetLabel("Enter your context first: ")
}
}

// OnNewTopic - Define a new conversation button event
Expand Down Expand Up @@ -133,7 +137,9 @@ func OnExportTopic() {

// OnExportTrainedTopic - Export current conversation as a trained model as a .json file
func OnExportTrainedTopic() {
node.layout.eventManager.SaveTraining()
if node.controller.currentAgent.preferences.IsTraining {
node.layout.eventManager.SaveTraining()
}
}

// OnChangeEngine - Dropdown from input to change engine
Expand Down Expand Up @@ -183,21 +189,21 @@ func OnChangeEngine(option string, optionIndex int) {
// OnChangeWords - Dropdown for tokens according to the amount of words
func OnChangeWords(option string, optionIndex int) {
switch option {
case "1":
case "\u0031":
node.controller.currentAgent.preferences.MaxTokens = util.ParseInt64("\u0031")
case "50":
case "\u0035\u0030":
node.controller.currentAgent.preferences.MaxTokens = util.ParseInt64("\u0033\u0031")
case "85":
case "\u0038\u0035":
node.controller.currentAgent.preferences.MaxTokens = util.ParseInt64("\u0036\u0034")
case "100":
case "\u0031\u0030\u0030":
node.controller.currentAgent.preferences.MaxTokens = util.ParseInt64("\u0037\u0035")
case "200":
case "\u0032\u0030\u0030":
node.controller.currentAgent.preferences.MaxTokens = util.ParseInt64("\u0031\u0035\u0030")
case "500":
case "\u0035\u0030\u0030":
node.controller.currentAgent.preferences.MaxTokens = util.ParseInt64("\u0033\u0037\u0035")
case "1000":
case "\u0031\u0030\u0030\u0030":
node.controller.currentAgent.preferences.MaxTokens = util.ParseInt64("\u0037\u0035\u0030")
case "1500":
case "\u0031\u0035\u0030\u0030":
node.controller.currentAgent.preferences.MaxTokens = util.ParseInt64("\u0031\u0031\u0032\u0035")
}
}
Expand Down
27 changes: 13 additions & 14 deletions service/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"time"

"caos/model"
"caos/service/parameters"
"caos/util"

"github.com/PullRequestInc/go-gpt3"
Expand All @@ -19,31 +18,31 @@ import (
type EventManager struct {
event model.HistoricalEvent
session model.HistoricalSession
handler parameters.PoolManager
pool model.PoolProperties
}

// SaveTraining - Export training in JSON format
func (c EventManager) SaveTraining() {
raw, _ := json.MarshalIndent(c.handler.TrainingSessionPool, "", "\u0009")
raw, _ := json.MarshalIndent(c.pool.TrainingSession, "", "\u0009")
out := util.ConstructPathFileTo("training", "json")
out.WriteString(string(raw))
}

// SaveLog - Save log with actual historic detail
func (c EventManager) SaveLog() {
if c.handler.SessionPool != nil {
raw, _ := json.MarshalIndent(c.handler.SessionPool[len(c.handler.SessionPool)-1], "", "\u0009")
if c.pool.Session != nil {
raw, _ := json.MarshalIndent(c.pool.Session[len(c.pool.Session)-1], "", "\u0009")
out := util.ConstructPathFileTo("log", "json")
out.WriteString(string(raw))
}
}

// ClearSession - Clear all the pools
func (c EventManager) ClearSession() {
c.handler.EventPool = nil
c.handler.SessionPool = nil
c.handler.TrainingEventPool = nil
c.handler.TrainingSessionPool = nil
c.pool.Event = nil
c.pool.Session = nil
c.pool.TrainingEvent = nil
c.pool.TrainingSession = nil
}

// AppendToSession - Add a set of events as a session
Expand Down Expand Up @@ -72,10 +71,10 @@ func (c EventManager) AppendToSession(header *model.EngineProperties, body *mode

c.event.Timestamp = fmt.Sprint(time.Now().UnixMilli())

c.handler.EventPool = append(c.handler.EventPool, c.event)
c.pool.Event = append(c.pool.Event, c.event)

c.session.ID = id
c.session.Session = c.handler.EventPool
c.session.Session = c.pool.Event

if node.controller.currentAgent.preferences.IsTraining {

Expand All @@ -84,17 +83,17 @@ func (c EventManager) AppendToSession(header *model.EngineProperties, body *mode
Event: train,
}

c.handler.TrainingEventPool = append(c.handler.TrainingEventPool, event)
c.pool.TrainingEvent = append(c.pool.TrainingEvent, event)

session := model.HistoricalTrainingSession{
ID: c.session.ID,
Session: []model.HistoricalTrainingEvent{event},
}

c.handler.TrainingSessionPool = append(c.handler.TrainingSessionPool, session)
c.pool.TrainingSession = append(c.pool.TrainingSession, session)
}

c.handler.SessionPool = append(c.handler.SessionPool, c.session)
c.pool.Session = append(c.pool.Session, c.session)

c.SaveLog()
}
Expand Down
16 changes: 0 additions & 16 deletions service/parameters/pool.go

This file was deleted.

0 comments on commit 806bbfb

Please sign in to comment.