Skip to content
Snippets Groups Projects

Dev

Merged Julian Rasch requested to merge jr662933/jupyterhub-ai:dev into dev
3 files
+ 28
28
Compare changes
  • Side-by-side
  • Inline
Files
3
+ 11
3
 
import os
from datetime import datetime
from datetime import datetime
from dash import (
from dash import (
@@ -10,7 +11,7 @@ from dash.dependencies import (
@@ -10,7 +11,7 @@ from dash.dependencies import (
State
State
)
)
from llm_utils.client import ChatGPT
from llm_utils.client import ChatGPT, get_openai_client
def format_chat_messages(chat_history):
def format_chat_messages(chat_history):
@@ -24,8 +25,15 @@ def format_chat_messages(chat_history):
@@ -24,8 +25,15 @@ def format_chat_messages(chat_history):
def register_callbacks(app: Dash):
def register_callbacks(app: Dash):
model="gpt4"
chat_gpt = ChatGPT(model="gpt4")
client = get_openai_client(
 
model=model,
 
config_path=os.environ.get("CONFIG_PATH")
 
)
 
chat_gpt = ChatGPT(
 
client=client,
 
model="gpt4"
 
)
@app.callback(
@app.callback(
[Output('chat-container', 'children'),
[Output('chat-container', 'children'),
Loading