Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -81,7 +81,6 @@ models = [
|
|
81 |
{"id": "cognitivecomputations/dolphin-2.9.1-llama-3-70b", "object": "model", "created": 1686935002, "owned_by": "cognitivecomputations"},
|
82 |
{"id": "nvidia/Nemotron-4-340B-Instruct", "object": "model", "created": 1686935002, "owned_by": "nvidia"},
|
83 |
{"id": "Qwen/Qwen2-72B-Instruct", "object": "model", "created": 1686935002, "owned_by": "qwen"},
|
84 |
-
{"id": "microsoft/Phi-3-medium-4k-instruct", "object": "model", "created": 1686935002, "owned_by": "microsoft"},
|
85 |
{"id": "google/gemma-2-9b-it", "object": "model", "created": 1686935002, "owned_by": "ConsiousAI"},
|
86 |
{"id": "openchat/openchat-3.6-8b", "object": "model", "created": 1686935002, "owned_by": "unknown"},
|
87 |
{"id": "mistralai/Mistral-7B-Instruct-v0.3", "object": "model", "created": 1686935002, "owned_by": "mistral"},
|
@@ -93,7 +92,7 @@ models = [
|
|
93 |
|
94 |
]
|
95 |
|
96 |
-
@app.post("/v1/chat/completions
|
97 |
def handle_completions(completion_request: CompletionRequest):
|
98 |
system_prompt = next((message.content for message in completion_request.messages if message.role == 'system'), None)
|
99 |
user_query = next((message.content for message in completion_request.messages if message.role == 'user'), None)
|
@@ -110,11 +109,11 @@ def handle_completions(completion_request: CompletionRequest):
|
|
110 |
)
|
111 |
return response
|
112 |
|
113 |
-
@app.get("/v1/models
|
114 |
def get_models():
|
115 |
return {"object": "list", "data": models}
|
116 |
|
117 |
-
@app.post("/v1/completions
|
118 |
def create_completion(prompt: str, model: str, best_of: int = 1, echo: bool = False, frequency_penalty: float = 0.0):
|
119 |
response_text = generative(prompt, "you are an helpful assistant", model)
|
120 |
|
|
|
81 |
{"id": "cognitivecomputations/dolphin-2.9.1-llama-3-70b", "object": "model", "created": 1686935002, "owned_by": "cognitivecomputations"},
|
82 |
{"id": "nvidia/Nemotron-4-340B-Instruct", "object": "model", "created": 1686935002, "owned_by": "nvidia"},
|
83 |
{"id": "Qwen/Qwen2-72B-Instruct", "object": "model", "created": 1686935002, "owned_by": "qwen"},
|
|
|
84 |
{"id": "google/gemma-2-9b-it", "object": "model", "created": 1686935002, "owned_by": "ConsiousAI"},
|
85 |
{"id": "openchat/openchat-3.6-8b", "object": "model", "created": 1686935002, "owned_by": "unknown"},
|
86 |
{"id": "mistralai/Mistral-7B-Instruct-v0.3", "object": "model", "created": 1686935002, "owned_by": "mistral"},
|
|
|
92 |
|
93 |
]
|
94 |
|
95 |
+
@app.post("/v1/chat/completions")
|
96 |
def handle_completions(completion_request: CompletionRequest):
|
97 |
system_prompt = next((message.content for message in completion_request.messages if message.role == 'system'), None)
|
98 |
user_query = next((message.content for message in completion_request.messages if message.role == 'user'), None)
|
|
|
109 |
)
|
110 |
return response
|
111 |
|
112 |
+
@app.get("/v1/models")
|
113 |
def get_models():
|
114 |
return {"object": "list", "data": models}
|
115 |
|
116 |
+
@app.post("/v1/completions")
|
117 |
def create_completion(prompt: str, model: str, best_of: int = 1, echo: bool = False, frequency_penalty: float = 0.0):
|
118 |
response_text = generative(prompt, "you are an helpful assistant", model)
|
119 |
|