[go: up one dir, main page]

Skip to content

Commit

Permalink
add examples, bump api v
Browse files Browse the repository at this point in the history
  • Loading branch information
ctrl-alt-lulz committed Feb 29, 2024
1 parent 8ed4687 commit fb9db62
Show file tree
Hide file tree
Showing 38 changed files with 544 additions and 20 deletions.
15 changes: 14 additions & 1 deletion .openapi/mockingbird.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
openapi: 3.0.3
info:
title: Mockingbird API
version: "1.0.1-beta.rc0"
version: "1.0.2-beta.rc0"
servers:
- url: https://api.zeus.fyi/v1
paths:
Expand Down Expand Up @@ -1000,14 +1000,27 @@ components:
nullable: true
endpointREST:
type: string
enum:
- get
- put
- post
- delete
nullable: true
payloadPreProcessing:
type: string
enum:
- iterate
- iterate-qp-only
- bulk
nullable: true
regexPatterns:
type: array
items:
type: string
payloadKeys:
type: array
items:
type: string
DiscordFilters:
type: object
properties:
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ GOMODCACHE := $(shell go env GOMODCACHE)
GOCACHE := $(shell go env GOCACHE)
GOOS := linux
GOARCH := amd64
VERSION := 1.0.1-beta.rc0
VERSION := 1.0.2-beta.rc0

# hercules build info
REPO := zeusfyi
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import requests

from examples.mockingbird.python.api_setup import api_v1_path, get_headers
from examples.mockingbird.mockingbooks_py.api_setup import api_v1_path, get_headers


def create_agg_task(task):
Expand All @@ -15,6 +15,7 @@ def create_agg_task(task):
else:
print(response.json())
print("Failed to create task. Status Code:", response.status_code)
return response.json()


if __name__ == '__main__':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import requests

from examples.mockingbird.python.api_setup import get_headers, api_v1_path
from examples.mockingbird.mockingbooks_py.api_setup import get_headers, api_v1_path


def get_task(tid):
Expand All @@ -18,6 +18,7 @@ def get_task(tid):
print(pretty_task_data)
else:
print("Failed to fetch task data. Status Code:", response.status_code)
return response.json()


def create_analysis_task(task):
Expand All @@ -30,6 +31,7 @@ def create_analysis_task(task):
else:
print(response.json())
print("Failed to create task. Status Code:", response.status_code)
return response.json()


if __name__ == '__main__':
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import yaml

config_file_path = '../../../test/configs/config.yaml'
config_file_path = '../../../../test/configs/config.yaml'
with open(config_file_path, 'r') as file:
config = yaml.safe_load(file)

Expand All @@ -9,8 +9,8 @@
'Authorization': f'Bearer {bearer_token}'
}

api_v1_path = "https://api.zeus.fyi/v1"
# api_v1_path = "http://localhost:9001/v1"
# api_v1_path = "https://api.zeus.fyi/v1"
api_v1_path = "http://localhost:9001/v1"


def get_headers():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import requests

from examples.mockingbird.python.api_setup import get_headers, api_v1_path
from examples.mockingbird.python.triggers import trigger_function_template
from examples.mockingbird.mockingbooks_py.api_setup import get_headers, api_v1_path
from examples.mockingbird.mockingbooks_py.triggers import trigger_function_template


def get_evals():
Expand All @@ -16,6 +16,7 @@ def get_evals():
print(pretty_data)
else:
print("Status Code:", response.status_code)
return response.json()


def create_or_update_eval(eval_fn):
Expand All @@ -28,6 +29,7 @@ def create_or_update_eval(eval_fn):
print(pretty_data)
else:
print("Status Code:", response.status_code)
return response.json()


if __name__ == '__main__':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"evalFns": [
{
"evalID": 0,
"evalName": "google-seach-query-param",
"evalName": "google-search-query-param",
"evalType": "model",
"evalGroupName": "google-search",
"evalModel": "gpt-4-0125-preview",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import requests

from examples.mockingbird.python.api_setup import get_headers, api_v1_path
from examples.mockingbird.mockingbooks_py.api_setup import get_headers, api_v1_path


def get_retrieval(rid):
Expand All @@ -18,6 +18,7 @@ def get_retrieval(rid):
print(pretty_data)
else:
print("Failed to fetch task data. Status Code:", response.status_code)
return response.json()


def create_or_update_retrieval(ret):
Expand All @@ -30,6 +31,7 @@ def create_or_update_retrieval(ret):
else:
print(response.json())
print("Failed to create retrieval. Status Code:", response.status_code)
return response.json()


if __name__ == '__main__':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import requests

from examples.mockingbird.python.api_setup import get_headers, api_v1_path
from examples.mockingbird.mockingbooks_py.api_setup import get_headers, api_v1_path


def get_runs():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,19 @@

import requests

from examples.mockingbird.python.api_setup import get_headers, api_v1_path
from examples.mockingbird.mockingbooks_py.api_setup import get_headers, api_v1_path


def get_schemas():
url = api_v1_path + "/schemas/ai"
headers = get_headers()
response = requests.get(url, headers=headers)
if response.status_code == 200:
pretty_data = json.dumps(data, indent=4)
pretty_data = json.dumps(response.json(), indent=4)
print(pretty_data)
else:
print("Status Code:", response.status_code)
return response.json()


def create_or_update_schema(schema):
Expand All @@ -25,6 +26,7 @@ def create_or_update_schema(schema):
else:
print(response.json())
print("Failed to create schema. Status Code:", response.status_code)
return response.json()


field_data_template = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"workflowGroupName": "wf-group",
"stepSize": 5,
"stepSizeUnit": "minutes",
"models": {},
"models": {
},
"evalsMap": {},
"evalTasksMap": {},
"aggregateSubTasksMap": {},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import requests

from examples.mockingbird.python.api_setup import get_headers, api_v1_path
from examples.mockingbird.mockingbooks_py.api_setup import get_headers, api_v1_path


def get_triggers():
Expand All @@ -15,6 +15,7 @@ def get_triggers():
print(pretty_data)
else:
print("Status Code:", response.status_code)
return response.json()


def create_or_update_trigger(trigger_fn):
Expand All @@ -27,8 +28,7 @@ def create_or_update_trigger(trigger_fn):
print(pretty_data)
else:
print("Status Code:", response.status_code)

pass
return response.json()


trigger_function_template = {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"retrievalStrID": "1709234668011517000",
"retrievalID": 1709234668011517000,
"retrievalName": "likes_llm_tweets",
"retrievalGroup": "mockingbird_wai",
"retrievalItemInstruction": {
"retrievalPlatform": "api",
"retrievalPrompt": "",
"retrievalPlatformGroups": "",
"retrievalKeywords": "",
"retrievalUsernames": "",
"discordFilters": {
"categoryTopic": "",
"categoryName": "",
"category": ""
},
"webFilters": {
"routingGroup": "twitter-mockingbird_wai",
"lbStrategy": "",
"endpointRoutePath": "users/1752505182343286784/likes",
"endpointREST": "post",
"payloadPreProcessing": "iterate",
"payloadKeys": [
"tweet_id"
]
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
{
"evalStrID": "1709235168313914137",
"evalID": 1709235168313914137,
"evalName": "like-tweets-mb",
"evalType": "model",
"evalGroupName": "twitter-mb",
"evalModel": "gpt-3.5-turbo-0125",
"evalFormat": "json",
"triggerFunctions": [
{
"triggerStrID": "1709235049105085000",
"triggerID": 1709235049105085000,
"triggerName": "mb-likes-tweets",
"triggerGroup": "twitter-mb",
"triggerAction": "api-retrieval",
"evalTriggerAction": {
"evalTriggerState": "",
"evalResultsTriggerOn": ""
},
"evalTriggerActions": [
{
"evalStrID": "1709235168313914137",
"triggerID": 1709235049105085000,
"triggerStrID": "1709235049105085000",
"evalTriggerState": "filter",
"evalResultsTriggerOn": "all-pass"
}
]
}
],
"schemas": [
{
"schemaID": 1709233769412026000,
"schemaStrID": "1709233769412026000",
"schemaName": "extract_relevant_tweets",
"schemaGroup": "mockingbird",
"schemaDescription": "This extracts tweet ids and calculates a spam score from 1-5.",
"isObjArray": true,
"fields": [
{
"fieldID": 1709243089471223000,
"fieldStrID": "1709243089471223000",
"fieldName": "tweet_id",
"fieldDescription": "The analyzed id value.",
"dataType": "string",
"evalMetrics": [
{
"evalMetricID": 1709246063536426000,
"evalOperator": "length-greater-than",
"evalState": "filter",
"evalExpectedResultState": "pass",
"evalMetricComparisonValues": {
"evalComparisonString": "10"
}
}
]
},
{
"fieldID": 1709245946134161000,
"fieldStrID": "1709245946134161000",
"fieldName": "msg_spam_score",
"fieldDescription": "Score each message from 1-5 Scoring System Score 5: Likely Spam, Commercial, or Job Listing Contains phrases like \"Find unclaimed airdrops\", \"Start of the Year with a Big Pump\", or direct links to commercial products or services.Includes job listings or straightforward job-related announcements.Lacks personal interaction or conversational tone. Score 4: General Announcements or Basic Information Sharing Includes general updates or news without a clear invitation for discussion.May contain links to blogs, news articles, or general information about Kubernetes or related technology, but lacks personal engagement. Score 3: Mildly Engaging or Indirectly Inviting Interaction Tweets that share information with a slight personal touch or a hint of seeking interaction.Might include personal opinions or experiences related to Kubernetes, GitOps, or DevOps but doesn\u2019t actively seek responses. Score 2: Directly Engaging and Discussion Oriented Clearly seeks interaction by asking questions or soliciting opinions.Includes tweets that share experiences or problems related to Kubernetes, GitOps, LLMs, or DevOps with a clear invitation for advice or discussion. Score 1: Highly Interactive and Response-Oriented Directly asks for help, suggestions, or recommendations related to Kubernetes, GitOps, DevOps, MLOps, LLMs, or developer platforms. Demonstrates a clear intention to engage in a conversation or discussion.May include tweets responding to others' queries, offering advice, or sharing knowledge in an interactive manner. ",
"dataType": "integer",
"evalMetrics": [
{
"evalMetricID": 1709246063594665000,
"evalOperator": "lt",
"evalState": "filter",
"evalExpectedResultState": "pass",
"evalMetricComparisonValues": {
"evalComparisonNumber": 4
}
}
]
}
]
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"retrievalStrID": "1709234959989201000",
"retrievalID": 1709234959989201000,
"retrievalName": "get_llm_tweets",
"retrievalGroup": "mockingbird_wai",
"retrievalItemInstruction": {
"retrievalPlatform": "twitter",
"retrievalPrompt": "",
"retrievalPlatformGroups": "llm",
"retrievalKeywords": "",
"retrievalUsernames": "",
"discordFilters": {
"categoryTopic": "",
"categoryName": "",
"category": ""
},
"webFilters": {
"routingGroup": "",
"lbStrategy": "",
"endpointRoutePath": "",
"endpointREST": ""
}
}
}
Loading

0 comments on commit fb9db62

Please sign in to comment.