Skip to content

Commit

Permalink
Merge pull request #180 from zeus-fyi/add-mb-code
Browse files Browse the repository at this point in the history
Add mb code
  • Loading branch information
ctrl-alt-lulz authored Feb 16, 2024
2 parents d89fb62 + 088efd7 commit 52348f4
Show file tree
Hide file tree
Showing 5 changed files with 214 additions and 3 deletions.
168 changes: 165 additions & 3 deletions .openapi/mockingbird.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,80 @@
openapi: 3.0.3
info:
title: Mockingbird API
description: API Description
version: "1.0.0"
version: "1.0.1-beta.rc0"
servers:
- url: https://api.zeus.fyi/v1
paths:
/tasks/ai:
post:
summary: Create/Update AI Tasks
description: "Create an AI Task to be used in a workflow. This will be used to
generate a prompt for the AI model to generate a response."
operationId: createOrUpdateAITask
tags:
- Tasks
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/AITaskLibrary'
responses:
'200':
description: AI Task successfully created
content:
application/json:
schema:
$ref: '#/components/schemas/AITaskLibrary'
'400':
description: Bad Request
'500':
description: Server Error
/schemas/ai:
get:
summary: Get JsonSchemaDefinitions
operationId: getJsonSchemaDefinitions
tags:
- Schemas
responses:
'200':
description: A list or map of JsonSchemaDefinitions
content:
application/json:
schema:
$ref: '#/components/schemas/JsonSchemasGroup'
'404':
description: JsonSchemaDefinitions not found
'500':
description: Internal server error
post:
summary: Create/Update JsonSchemaDefinition
operationId: createJsonSchemaDefinition
tags:
- Schemas
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/JsonSchemaDefinition'
responses:
'201':
description: Successfully created JsonSchemaDefinition
content:
application/json:
schema:
$ref: '#/components/schemas/JsonSchemaDefinition'
'400':
description: Invalid input
'500':
description: Internal server error
/workflows/ai/actions:
post:
summary: Exec Workflow
operationId: execWorkflow
tags:
- Workflows
requestBody:
required: true
content:
Expand Down Expand Up @@ -64,6 +129,8 @@ paths:
get:
summary: Workflow Runs
operationId: getAIRunsAnalyses
tags:
- Runs
responses:
'200':
description: An array of orchestrations analyses
Expand Down Expand Up @@ -195,6 +262,11 @@ components:
nullable: true
JsonSchemaField:
type: object
required:
- fieldName
- fieldDescription
- dataType
- fieldValue
properties:
fieldID:
type: integer
Expand Down Expand Up @@ -248,6 +320,30 @@ components:
type: boolean
isValidated:
type: boolean
JsonSchemaDefinition:
type: object
required:
- schemaName
- schemaGroup
- schemaDescription
- isObjArray
properties:
schemaID:
type: integer
schemaStrID:
type: string
schemaName:
type: string
schemaGroup:
type: string
schemaDescription:
type: string
isObjArray:
type: boolean
fields:
type: array
items:
$ref: '#/components/schemas/JsonSchemaField'
EvalMetricResult:
type: object
properties:
Expand Down Expand Up @@ -278,4 +374,70 @@ components:
evalMetadata:
type: string
format: byte
nullable: true
nullable: true
AITaskLibrary:
type: object
required:
- taskName
- taskGroup
- taskType
- model
- responseFormat
properties:
taskStrID:
type: string
taskID:
type: integer
maxTokensPerTask:
type: integer
taskType:
type: string
taskName:
type: string
taskGroup:
type: string
tokenOverflowStrategy:
type: string
enum:
- deduce
- truncate
model:
type: string
enum:
- gpt-3.5-turbo-0125
- gpt-3.5-turbo-1106
- gpt-4-32k
- gpt-4-32k-0613
- gpt-4-0613
- gpt-4-1106-preview
- gpt-4-0125-preview
temperature:
type: number
minimum: 0
maximum: 2
marginBuffer:
type: number
minimum: 0.2
maximum: 0.8
prompt:
type: string
schemas:
type: array
items:
$ref: '#/components/schemas/JsonSchemaDefinition'
responseFormat:
type: string
enum:
- json
- text
JsonSchemasGroup:
type: object
properties:
jsonSchemaDefinitionsSlice:
type: array
items:
$ref: '#/components/schemas/JsonSchemaDefinition'
jsonSchemaDefinitionsMap:
type: object
additionalProperties:
$ref: '#/components/schemas/JsonSchemaDefinition'
1 change: 1 addition & 0 deletions apps/docusaurus/zeusfyi/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ const config = {
// Plugin Options for loading OpenAPI files
specs: [
{
//spec: '/Users/alex/go/Olympus/Zeus/.openapi/mockingbird.yaml',
spec: 'https://raw.githubusercontent.com/zeus-fyi/zeus/main/.openapi/mockingbird.yaml',
route: '/docs/mockingbird/api/',
},
Expand Down
20 changes: 20 additions & 0 deletions zeus/mockingbird/evals/evals.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package mb_evals

import (
mb_json_schemas "github.com/zeus-fyi/zeus/zeus/mockingbird/json_schemas"
)

type EvalFn struct {
EvalStrID *string `json:"evalStrID,omitempty"`
EvalID *int `json:"evalID,omitempty"`
OrgID int `json:"orgID,omitempty"`
UserID int `json:"userID,omitempty"`
EvalName string `json:"evalName"`
EvalType string `json:"evalType"`
EvalGroupName string `json:"evalGroupName"`
EvalModel *string `json:"evalModel,omitempty"`
EvalFormat string `json:"evalFormat"`
EvalCycleCount int `json:"evalCycleCount,omitempty"`
Schemas []*mb_json_schemas.JsonSchemaDefinition `json:"schemas,omitempty"`
SchemasMap map[string]*mb_json_schemas.JsonSchemaDefinition `json:"schemaMap"`
}
27 changes: 27 additions & 0 deletions zeus/mockingbird/tasks/tasks.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package mb_tasks

import (
mb_evals "github.com/zeus-fyi/zeus/zeus/mockingbird/evals"
mb_json_schemas "github.com/zeus-fyi/zeus/zeus/mockingbird/json_schemas"
mb_search "github.com/zeus-fyi/zeus/zeus/mockingbird/search"
)

type AITaskLibrary struct {
TaskStrID string `db:"-" json:"taskStrID,omitempty"`
TaskID int `db:"task_id" json:"taskID,omitempty"`
MaxTokensPerTask int `db:"max_tokens_per_task" json:"maxTokensPerTask"`
TaskType string `db:"task_type" json:"taskType"`
TaskName string `db:"task_name" json:"taskName"`
TaskGroup string `db:"task_group" json:"taskGroup"`
TokenOverflowStrategy string `db:"token_overflow_strategy" json:"tokenOverflowStrategy"`
Model string `db:"model" json:"model"`
Temperature float64 `db:"temperature" json:"temperature"`
MarginBuffer float64 `db:"margin_buffer" json:"marginBuffer"`
Prompt string `db:"prompt" json:"prompt"`
Schemas []*mb_json_schemas.JsonSchemaDefinition `json:"schemas,omitempty"`
SchemasMap map[string]*mb_json_schemas.JsonSchemaDefinition `json:"schemasMap,omitempty"`
ResponseFormat string `db:"response_format" json:"responseFormat"`
CycleCount int `db:"cycle_count" json:"cycleCount,omitempty"`
RetrievalDependencies []mb_search.RetrievalItem `json:"retrievalDependencies,omitempty"`
EvalFns []mb_evals.EvalFn `json:"evalFns,omitempty"`
}
1 change: 1 addition & 0 deletions zeus/mockingbird/triggers/triggers.go
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package triggers

0 comments on commit 52348f4

Please sign in to comment.