Added Float type to the function parameter values (#77)

This commit is contained in:
Sampreeth Sarma 2024-09-25 13:29:20 -07:00 committed by GitHub
parent 7505a0fc1f
commit 7f0fcb372b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
26 changed files with 1505 additions and 45 deletions

View file

@ -1,6 +1,7 @@
import json
from fastapi import FastAPI, Response
from bolt_handler import BoltHandler
from arch_handler import ArchHandler
from common import ChatMessage
import logging
from openai import OpenAI
@ -14,7 +15,8 @@ logger.info(f"using model: {ollama_model}")
logger.info(f"using ollama endpoint: {ollama_endpoint}")
app = FastAPI()
handler = BoltHandler()
bolt_handler = BoltHandler()
arch_handler = ArchHandler()
client = OpenAI(
base_url='http://{}:11434/v1/'.format(ollama_endpoint),
@ -33,6 +35,10 @@ async def healthz():
@app.post("/v1/chat/completions")
async def chat_completion(req: ChatMessage, res: Response):
logger.info("starting request")
if ollama_model.startswith("Bolt"):
handler = bolt_handler
else:
handler = arch_handler
tools_encoded = handler._format_system(req.tools)
# append system prompt with tools to messages
messages = [{"role": "system", "content": tools_encoded}]