Skip to content

Commit

Permalink
restored newest function
Browse files Browse the repository at this point in the history
  • Loading branch information
alexj1701 committed Feb 28, 2024
1 parent 7d9fd55 commit 036b10f
Showing 1 changed file with 37 additions and 17 deletions.
54 changes: 37 additions & 17 deletions backend/lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,49 @@
import os
from openai import OpenAI

_tools = [
tools = [
{
"type": "function",
"function": {
"name": "filter_classes_by_rating",
"description": "",
"parameters": {
"type": "object",
"properties": {
"operator": {
"type": "string",
"enum": ["$gt", "$lt", '$gte', '$lte', '$eq'],
"description": "The operator to use for the filter",
},
"rating": {
"type": "number",
"description": "The rating to filter by",
},
"name": "CourseFilter",
"description": "Provide filters for a course based on conditions.",
"parameters": {
"type": "object",
"properties": {
"subject_code": {
~ "type": "string",
"enum": [str(key) for key in subjects.keys()],
"description": "A code for the subject of instruction",
},
"required": ["operator", "rating"],
"rating": {
"type": "number",
"description": "The rating (a number with one significant digit) for the class (0 - 4). If a number is not provided, interpret the given opinion to fit the range. A good, or average, class should be 3.5",
},
"comparison_operator_rating": {
"type": "string",
"enum": ["$lt", "$gt", "$gte", "$lte"],
"description": "A comparison operator for the class rating",
},
"workload": {
"type": "number",
"description": "The workload (a number with one significant digit) for the class (0 - 4). If a number is not provided, interpret the given opinion to fit the range.",
},
"comparison_operator_workload": {
"type": "string",
"enum": ["$lt", "$gt", "$gte", "$lte"],
"description": "A comparison operator for the class workload",
},
"comparison_operator_workload": {
"type": "string",
"enum": ["$lt", "$gt", "$gte", "$lte"],
"description": "A comparison operator for the class workload",
},

},
"required": ["comparison_operator_rating", "rating"],
},
}
},
}
]

# client = OpenAI(api_key=os.getenv("OPENAI_API_KEY"))
Expand Down

0 comments on commit 036b10f

Please sign in to comment.