Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
| 1 |
import os
|
| 2 |
import json
|
|
|
|
| 3 |
from fastapi import FastAPI, HTTPException
|
| 4 |
from pydantic import BaseModel, Field
|
| 5 |
from huggingface_hub import InferenceClient
|
|
@@ -52,7 +53,7 @@ def format_prompt_for_text_generation(system_prompt: str, history: list, prompt:
|
|
| 52 |
return out
|
| 53 |
|
| 54 |
|
| 55 |
-
def chat_completion_via_http(messages: list, max_tokens: int, temperature: float, top_p: float) -> str
|
| 56 |
"""
|
| 57 |
Chiamata diretta all'endpoint HF chat completions (v1).
|
| 58 |
Usata quando il SDK fallisce perché il modello non dichiara il task (es. Ministral-3).
|
|
|
|
| 1 |
import os
|
| 2 |
import json
|
| 3 |
+
from typing import Optional
|
| 4 |
from fastapi import FastAPI, HTTPException
|
| 5 |
from pydantic import BaseModel, Field
|
| 6 |
from huggingface_hub import InferenceClient
|
|
|
|
| 53 |
return out
|
| 54 |
|
| 55 |
|
| 56 |
+
def chat_completion_via_http(messages: list, max_tokens: int, temperature: float, top_p: float) -> Optional[str]:
|
| 57 |
"""
|
| 58 |
Chiamata diretta all'endpoint HF chat completions (v1).
|
| 59 |
Usata quando il SDK fallisce perché il modello non dichiara il task (es. Ministral-3).
|