update api like OpenAI
This commit is contained in:
parent
58f8ae9bfe
commit
6c277eaab5
2 changed files with 5 additions and 2 deletions
|
@ -8,6 +8,7 @@ import json
|
||||||
|
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
|
slot_id = -1
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(description="An example of using server.cpp with a similar API to OAI. It must be used together with server.cpp.")
|
parser = argparse.ArgumentParser(description="An example of using server.cpp with a similar API to OAI. It must be used together with server.cpp.")
|
||||||
parser.add_argument("--chat-prompt", type=str, help="the top prompt in chat completions(default: 'A chat between a curious user and an artificial intelligence assistant. The assistant follows the given rules no matter what.\\n')", default='A chat between a curious user and an artificial intelligence assistant. The assistant follows the given rules no matter what.\\n')
|
parser.add_argument("--chat-prompt", type=str, help="the top prompt in chat completions(default: 'A chat between a curious user and an artificial intelligence assistant. The assistant follows the given rules no matter what.\\n')", default='A chat between a curious user and an artificial intelligence assistant. The assistant follows the given rules no matter what.\\n')
|
||||||
|
@ -77,7 +78,8 @@ def make_postData(body, chat=False, stream=False):
|
||||||
if(is_present(body, "stop")): postData["stop"] += body["stop"]
|
if(is_present(body, "stop")): postData["stop"] += body["stop"]
|
||||||
postData["n_keep"] = -1
|
postData["n_keep"] = -1
|
||||||
postData["stream"] = stream
|
postData["stream"] = stream
|
||||||
|
postData["cache_prompt"] = True
|
||||||
|
postData["slot_id"] = slot_id
|
||||||
return postData
|
return postData
|
||||||
|
|
||||||
def make_resData(data, chat=False, promptToken=[]):
|
def make_resData(data, chat=False, promptToken=[]):
|
||||||
|
@ -128,6 +130,7 @@ def make_resData_stream(data, chat=False, time_now = 0, start=False):
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
slot_id = data["slot_id"]
|
||||||
if (chat):
|
if (chat):
|
||||||
if (start):
|
if (start):
|
||||||
resData["choices"][0]["delta"] = {
|
resData["choices"][0]["delta"] = {
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
#include "build-info.h"
|
#include "build-info.h"
|
||||||
#include "grammar-parser.h"
|
#include "grammar-parser.h"
|
||||||
|
|
||||||
// #define SERVER_MULTIMODAL_SUPPORT
|
//#define SERVER_MULTIMODAL_SUPPORT
|
||||||
|
|
||||||
#ifdef SERVER_MULTIMODAL_SUPPORT
|
#ifdef SERVER_MULTIMODAL_SUPPORT
|
||||||
#include "../llava/clip.h"
|
#include "../llava/clip.h"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue