Experimenting with classification prompt.
This commit is contained in:
@@ -1,10 +1,26 @@
|
||||
from dash import Dash, Input, Output
|
||||
from dataclasses import dataclass
|
||||
from dash_extensions.enrich import Dash, Input, Output, callback
|
||||
import dash_core_components as dcc
|
||||
import dash_html_components as html
|
||||
from dash_local_react_components import load_react_component
|
||||
|
||||
app = Dash(__name__)
|
||||
|
||||
|
||||
@dataclass
|
||||
class WiseManDefinition:
|
||||
id: str
|
||||
name: str
|
||||
order_number: int
|
||||
system_prompt: str
|
||||
|
||||
|
||||
wise_man = [
|
||||
WiseManDefinition(id='melchior', name='MELCHIOR', order_number=1, system_prompt='You are a wise man'),
|
||||
WiseManDefinition(id='baltasar', name='BALTASAR', order_number=2, system_prompt='You are a wise man'),
|
||||
WiseManDefinition(id='casper', name='CASPAR', order_number=3, system_prompt='You are a wise man'),
|
||||
]
|
||||
|
||||
Magi = load_react_component(app, 'components', 'magi.js')
|
||||
WiseMan = load_react_component(app, 'components', 'wise_man.js')
|
||||
|
||||
|
||||
+24
-5
@@ -3,12 +3,31 @@ import openai
|
||||
response = openai.ChatCompletion.create(
|
||||
model="gpt-3.5-turbo",
|
||||
messages=[
|
||||
{"role": "system", "content": "You are a helpful assistant."},
|
||||
{"role": "user", "content": "Who won the world series in 2020?"},
|
||||
{"role": "assistant",
|
||||
"content": "The Los Angeles Dodgers won the World Series in 2020."},
|
||||
{"role": "user", "content": "Where was it played?"}
|
||||
{"role": "system", "content": "You answer questions with a simple 'yes' or 'no'."},
|
||||
{"role": "user", "content": "Can the following question be generally answered with a 'yes' or 'no'? \n Is C# better than Java?"},
|
||||
]
|
||||
)
|
||||
|
||||
# {
|
||||
# "choices": [
|
||||
# {
|
||||
# "finish_reason": "stop",
|
||||
# "index": 0,
|
||||
# "message": {
|
||||
# "content": "Yes.",
|
||||
# "role": "assistant"
|
||||
# }
|
||||
# }
|
||||
# ],
|
||||
# "created": 1684003959,
|
||||
# "id": "chatcmpl-7Foe7sKt2SqEWcjmI5VG9Jc5ndRrd",
|
||||
# "model": "gpt-3.5-turbo-0301",
|
||||
# "object": "chat.completion",
|
||||
# "usage": {
|
||||
# "completion_tokens": 2,
|
||||
# "prompt_tokens": 50,
|
||||
# "total_tokens": 52
|
||||
# }
|
||||
# }
|
||||
|
||||
print(response)
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
dash==2.9.3
|
||||
dash-extensions==1.0.0
|
||||
dash-local-react-components==1.3.0
|
||||
openai==0.27.6
|
||||
Reference in New Issue
Block a user