pull/1/head
killian 12 months ago
parent 7512783b5c
commit bd9cb4e8b7

BIN
.DS_Store vendored

Binary file not shown.

@ -9,6 +9,7 @@ Also needs to be saving conversations, and checking the queue.
from typing import Generator
import uvicorn
from fastapi import FastAPI, Request, Response
from starlette.exceptions import DisconnectedClientError
def main(interpreter):
@ -18,9 +19,15 @@ def main(interpreter):
async def i_endpoint(request: Request) -> Response:
async def event_stream() -> Generator[str, None, None]:
data = await request.json()
# TODO: Save conversation to /conversations
try:
for response in interpreter.chat(message=data["message"], stream=True):
yield response
# TODO: Check queue. Do we need to break (I guess we need a while loop around this..?)
# and handle the new message from the queue? Then delete the message from the queue.
except DisconnectedClientError:
print("Client disconnected")
# TODO: Save conversation to /conversations
return Response(event_stream(), media_type="text/event-stream")
uvicorn.run(app, host="0.0.0.0", port=8000)

@ -4,7 +4,7 @@ Responsible for configuring an interpreter, then using main.py to serve it at "/
from .main import main
from interpreter import interpreter
import os
### SYSTEM MESSAGE
@ -45,12 +45,16 @@ interpreter.system_message = system_message
### LLM SETTINGS
# Local settings
interpreter.llm.model = "local"
interpreter.llm.temperature = 0
interpreter.llm.api_base = "https://localhost:8080/v1" # Llamafile default
interpreter.llm.max_tokens = 1000
interpreter.llm.context_window = 3000
# Hosted settings
interpreter.llm.api_key = os.getenv('OPENAI_API_KEY')
interpreter.llm.model = "gpt-3.5-turbo"
### MISC SETTINGS

3012
OS/01/core/poetry.lock generated

File diff suppressed because it is too large Load Diff

@ -8,6 +8,7 @@ readme = "README.md"
[tool.poetry.dependencies]
python = "^3.11"
open-interpreter = "^0.2.0"
[build-system]

@ -1,6 +1,7 @@
### START THE LANGUAGE MODEL
python llm/start.py
# Disabled as we're starting with hosted models
# python llm/start.py
### START THE INTERPRETER

Loading…
Cancel
Save