mirror of
https://github.com/katanemo/plano.git
synced 2026-05-04 21:32:43 +02:00
Fold function_resolver into model_server (#103)
This commit is contained in:
parent
b0ce5eca93
commit
f4395d39f9
24 changed files with 31 additions and 197 deletions
|
|
@ -1,17 +1,20 @@
|
|||
import os
|
||||
from fastapi import FastAPI, Response, HTTPException
|
||||
from pydantic import BaseModel
|
||||
from load_models import (
|
||||
from app.load_models import (
|
||||
load_ner_models,
|
||||
load_transformers,
|
||||
load_guard_model,
|
||||
load_zero_shot_models,
|
||||
)
|
||||
from utils import GuardHandler, split_text_into_chunks
|
||||
from app.utils import GuardHandler, split_text_into_chunks
|
||||
import torch
|
||||
import yaml
|
||||
import string
|
||||
import time
|
||||
import logging
|
||||
from app.arch_fc.arch_fc import chat_completion as arch_fc_chat_completion, ChatMessage
|
||||
import os.path
|
||||
|
||||
logging.basicConfig(
|
||||
level=logging.INFO, format="%(asctime)s - %(levelname)s - %(message)s"
|
||||
|
|
@ -22,8 +25,11 @@ transformers = load_transformers()
|
|||
ner_models = load_ner_models()
|
||||
zero_shot_models = load_zero_shot_models()
|
||||
|
||||
with open("/root/arch_config.yaml", "r") as file:
|
||||
config = yaml.safe_load(file)
|
||||
config = {}
|
||||
|
||||
if os.path.exists("/root/arch_config.yaml"):
|
||||
with open("/root/arch_config.yaml", "r") as file:
|
||||
config = yaml.safe_load(file)
|
||||
with open("guard_model_config.yaml") as f:
|
||||
guard_model_config = yaml.safe_load(f)
|
||||
|
||||
|
|
@ -231,6 +237,12 @@ async def zeroshot(req: ZeroShotRequest, res: Response):
|
|||
}
|
||||
|
||||
|
||||
@app.post("/v1/chat/completions")
|
||||
async def chat_completion(req: ChatMessage, res: Response):
|
||||
result = await arch_fc_chat_completion(req, res)
|
||||
return result
|
||||
|
||||
|
||||
'''
|
||||
*****
|
||||
Adding new functions to test the usecases - Sampreeth
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue