Skip to content

Commit

Permalink
update reference 20231222
Browse files Browse the repository at this point in the history
  • Loading branch information
nmaguiar committed Dec 23, 2023
1 parent 912975f commit 66a01af
Show file tree
Hide file tree
Showing 11 changed files with 310 additions and 16 deletions.
12 changes: 6 additions & 6 deletions docs/reference/csv.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,19 @@ __CSV.clear()__
````
Clears all internal structures. This will clear all data stored previously in this instance.
````
### CSV.CSV
### CSV.csv

__CSV.CSV(aCsvString)__
__CSV.csv() : Array__

````
Creates a new instance of the CSV object. Optionally you can provide a string that contains a CSV.
Returns a javascript array of maps with the current internal CSV representation.
````
### CSV.csv
### CSV.CSV

__CSV.csv() : Array__
__CSV.CSV(aCsvString)__

````
Returns a javascript array of maps with the current internal CSV representation.
Creates a new instance of the CSV object. Optionally you can provide a string that contains a CSV.
````
### CSV.fromCSV

Expand Down
2 changes: 1 addition & 1 deletion docs/reference/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ has_children: true
nav_order: 4
---
# Reference
_version: 20231014_
_version: 20231222_
* __[afbase](afbase.md)__
* __[bsdiff](bsdiff.md)__
* __[console](console.md)__
Expand Down
218 changes: 218 additions & 0 deletions docs/reference/ow_ai.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,104 @@ grand_parent: OpenAF docs

## ow.ai

### $gpt

__$gpt(aModel) : $gpt__

````
Creates a GPT AI model of aType (e.g. "openai" or "ollama") with aOptions.
````
### $gpt.close

__$gpt.close()__

````
Closes the current GPT model.
````
### $gpt.iniPrompt

__$gpt.iniPrompt(aPrompt, aRole, aModel, aTemperature) : String__

````
Tries to prompt aPrompt (a string or an array of strings) and aModel (defaults to the one provided on the constructor) after cleaning the current conversation.
````
### $gpt.prompt

__$gpt.prompt(aPrompt, aRole, aModel, aTemperature) : String__

````
Tries to prompt aPrompt (a string or an array of strings) and aModel (defaults to the one provided on the constructor).
````
### $gpt.promptBool

__$gpt.promptBool(aPrompt, aRole, aModel, aTemperature) : boolean__

````
Tries to prompt aPrompt (a string or an array of strings) and aModel (defaults to the one provided on the constructor) returning a boolean.
````
### $gpt.promptImage

__$gpt.promptImage(aPrompt, aImage, aDetailLevel, aRole, aModel, aTemperature) : String__

````
Tries to prompt aPrompt (a string or an array of strings) with aImage (a file path or a base64 string representation), aRole (defaults to "user") and aModel (defaults to the one provided on the constructor).
````
### $gpt.promptJSON

__$gpt.promptJSON(aPrompt, aModel, aTemperature)__

````
Tries to prompt aPrompt (a string or an array of strings) and aModel (defaults to the one provided on the constructor) returning a Javascript function.
````
### $gpt.promptMD

__$gpt.promptMD(aPrompt, aRole, aModel, aTemperature) : String__

````
Tries to prompt aPrompt (a string or an array of strings) and aModel (defaults to the one provided on the constructor) returning a markdown string.
````
### $gpt.promptPath

__$gpt.promptPath(aPrompt, aJSONSchemaDef, aModel, aTemperature)__

````
Tries to prompt aPrompt (a string or an array of strings) and aModel (defaults to the one provided on the constructor) returning a JMESPath query.
````
### $gpt.promptSQL

__$gpt.promptSQL(aPrompt, aTableDefs, aDBName, aModel, aTemperature)__

````
Tries to prompt aPrompt (a string or an array of strings) and aModel (defaults to the one provided on the constructor) returning a SQL query.
````
### $gpt.sysPrompt

__$gpt.sysPrompt(aPrompt, aModel, aTemperature) : String__

````
Tries to prompt system aPrompt (a string or an array of strings) and aModel (defaults to the one provided on the constructor).
````
### $gpt.withContext

__$gpt.withContext(anObject, aContext) : ow.ai.gpt__

````
Adds a context to the current conversation.
````
### $gpt.withJSONAssert

__$gpt.withJSONAssert(aPath, anAssert) : ow.ai.gpt__

````
Adds a JSON path aPath to be asserted with anAssert (e.g. isArray or isMap).
````
### $gpt.withSQLTables

__$gpt.withSQLTables(aDBName, aTablesDefs) : ow.ai.gpt__

````
Adds aDBName with aTableDefs to be used with promptSQL.
````
### ow.ai.cluster

__ow.ai.cluster(args) : Object__
Expand Down Expand Up @@ -48,6 +146,126 @@ C45:
featureTypes (arrays of types) Categorization of each attribute between 'category' and 'number'
target (key) The target key name (the last of each array data value)
````
### ow.ai.gpt

__ow.ai.gpt(aType, aOptions) : ow.ai.gpt__

````
Creates a GPT AI model of aType (e.g. "openai" or "ollama") with aOptions.
````
### ow.ai.gpt.addPrompt

__ow.ai.gpt.addPrompt(aPrompt, aRole) : ow.ai.gpt__

````
Adds aPrompt (a string or an array of strings) with aRole (defaults to "user") to the current conversation.
````
### ow.ai.gpt.addSystemPrompt

__ow.ai.gpt.addSystemPrompt(aPrompt) : ow.ai.gpt__

````
Adds aPrompt (a string or an array of strings) with aRole (defaults to "user") to the current conversation.
````
### ow.ai.gpt.addUserPrompt

__ow.ai.gpt.addUserPrompt(aPrompt) : ow.ai.gpt__

````
Adds aPrompt (a string or an array of strings) with aRole (defaults to "user") to the current conversation.
````
### ow.ai.gpt.booleanPrompt

__ow.ai.gpt.booleanPrompt(aPrompt, aModel, aTemperature) : boolean__

````
Tries to prompt aPrompt (a string or an array of strings) with aRole (defaults to "user") and aModel (defaults to the one provided on the constructor).
````
### ow.ai.gpt.cleanPrompt

__ow.ai.gpt.cleanPrompt() : ow.ai.gpt__

````
Cleans the current conversation.
````
### ow.ai.gpt.codePrompt

__ow.ai.gpt.codePrompt(aPrompt, aModel, aTemperature, aCommentChars) : String__

````
Tries to prompt aPrompt (a string or an array of strings) with aRole (defaults to "user") and aModel (defaults to the one provided on the constructor).
````
### ow.ai.gpt.getConversation

__ow.ai.gpt.getConversation() : Array__

````
Returns the current conversation.
````
### ow.ai.gpt.jsonPrompt

__ow.ai.gpt.jsonPrompt(aPrompt, aModel, aTemperature) : Object__

````
Tries to prompt aPrompt (a string or an array of strings) with aRole (defaults to "user") and aModel (defaults to the one provided on the constructor).
````
### ow.ai.gpt.parseCode

__ow.ai.gpt.parseCode(anAnswer) : String__

````
Tries to parse anAnswer and return the code between \``` and \```.
````
### ow.ai.gpt.pathPrompt

__ow.ai.gpt.pathPrompt(aPrompt, aJSONSchemaDef, aModel, aTemperature) : String__

````
Tries to prompt aPrompt (a string or an array of strings) with aRole (defaults to "user") and aModel (defaults to the one provided on the constructor).
````
### ow.ai.gpt.prompt

__ow.ai.gpt.prompt(aPrompt, aRole, aModel, aTemperature) : String__

````
Tries to prompt aPrompt (a string or an array of strings) with aRole (defaults to "user") and aModel (defaults to the one provided on the constructor).
````
### ow.ai.gpt.promptImage

__ow.ai.gpt.promptImage(aPrompt, aImage, aDetailLevel, aRole, aModel, aTemperature) : String__

````
Tries to prompt aPrompt (a string or an array of strings) with aImage (a file path or a base64 string representation), aRole (defaults to "user") and aModel (defaults to the one provided on the constructor).
````
### ow.ai.gpt.rawPrompt

__ow.ai.gpt.rawPrompt(aPrompt, aRole, aModel, aTemperature) : String__

````
Tries to prompt aPrompt (a string or an array of strings) with aRole (defaults to "user") and aModel (defaults to the one provided on the constructor).
````
### ow.ai.gpt.setConversation

__ow.ai.gpt.setConversation(aConversation) : ow.ai.gpt__

````
Sets the current conversation to aConversation.
````
### ow.ai.gpt.setInstructions

__ow.ai.gpt.setInstructions(aType) : ow.ai.gpt__

````
Sets the instructions for the current conversation. aType can be a string (e.g. json, boolean, sql, js and path) or an array of strings.
````
### ow.ai.gpt.sqlPrompt

__ow.ai.gpt.sqlPrompt(aPrompt, aTableDefs, aDBName, aModel, aTemperature) : String__

````
Tries to prompt aPrompt (a string or an array of strings) with aRole (defaults to "user") and aModel (defaults to the one provided on the constructor).
````
### ow.ai.network

__ow.ai.network(aMap) : ow.ai.network__
Expand Down
9 changes: 8 additions & 1 deletion docs/reference/ow_debug.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,16 @@ Equivalent to OpenAF's "require" but registering the debug preparser. The commen
//? printVarA
//?s printInSLONVarA
//?y printInYAMLVarA
//?t printInTableVarA
//?r printInTreeVarA
//{ begin of unique block with prefix
//} end of unique block with prefix
//[ begin of unique profile block
//] end of unique profile block
//{[ begin of unique profile block with prefix
//]} end of unique profile block with prefix
//+ incrementVarA
//- decrementVarA\
````
### ow.debug.unregister
Expand Down
28 changes: 28 additions & 0 deletions docs/reference/ow_format.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ __ow.format.addNumberSeparator(aNumber, aSeparator) : String__
Returns a formatted number with decimal separators (default is comma but you can provide a custom aSeparator).
(available after ow.loadFormat())
````
### ow.format.bool

__ow.format.bool(aBoolValue, isLight, anExtra) : String__

````
Given aBoolValue will return a green checkmark or a red cross character. If necessary anExtra ansiColor attributes can be added.
````
### ow.format.cron.howManyAgo

__ow.format.cron.howManyAgo(aCron, lastUpdate, aLimit) : Map__
Expand Down Expand Up @@ -141,6 +148,20 @@ __ow.format.dateDiff.inYears(dateBefore, dateAfter) : Number__
````
Difference between dateAfter and dateBefore in years.
````
### ow.format.dateTimeTransition

__ow.format.dateTimeTransition(aZone, aDate) : Map__

````
Given aZone (defaults to Europe/London) and aDate (defaults to now) will return a map with the previous and next date/time transition.
````
### ow.format.dateTimeZones

__ow.format.dateTimeZones() : Array__

````
List all available Java zone ids.
````
### ow.format.elapsedTime

__ow.format.elapsedTime(aStartTime, aEndTime, aFormat) : String__
Expand Down Expand Up @@ -563,6 +584,13 @@ __ow.format.logWithWaiting(aMainFunc, aPrefixMsg, aCompleteMsg, aErrorMsg, aWait
````
Executes aMainFunc while log aPrefixMsg with a waiting aTheme (defaults to a sequence of chars with a rotating bar). When aMainFunc ends it will replace the log with aCompleteMsg or aErrorMsg in case an exception is thrown. Optionally you can provide a different aWaitSpeed while cycling between the aTheme sequence of chars increasing/decreasing the "animation" effect.
````
### ow.format.percentile

__ow.format.percentile(aArray, aPercentile) : Number__

````
Will return the percentile (aPercentile between 0 and 1) for the provided aArray of numbers.
````
### ow.format.percProgressReport

__ow.format.percProgressReport(aMainFunc, aProgressFunc, aTimeout)__
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/ow_java.md
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ Given the class array of bytes (aClassBytes), or a string from which the corresp
````
### ow.java.getCMemory

__ow.java.getCMemory(shouldFormat, aReadFileFn) : Map__
__ow.java.getCMemory(shouldFormat, aReadFileFn, aFileExistsFn) : Map__

````
Returns a map with the current cgroup runtime max, total, used and free memory. If shouldFormat = true ow.format.toBytesAbbreviation will be used. Optionally you can provide a aReadFileFn that should expect the full path on a linux cgroup root filesystem and return a string with the corresponding contents.
Expand Down
1 change: 1 addition & 0 deletions docs/reference/ow_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ Adds custom helpers:
- $default -- to be used with $switch for each case
- $ptable -- returns an ansi ascii printTable representation of an object
- $ptree -- returns an ansi ascii printTree representation of an object
- $output -- returns an $output representation of an object (aObj as 1st arg and options in slon as 2nd arg)
- $cjson -- returns an ansi ascii colority representation fo an object
- $cslon -- returns an ansi ascii colored SLON representation of an object
- $pmap -- returns an ansi ascii printMap representation of an object
Expand Down
Loading

0 comments on commit 66a01af

Please sign in to comment.