Spaces:
Running
Running
SUBHRAJIT MOHANTY commited on
Commit ·
3de5d6b
1
Parent(s): 5da4608
Updated the app.py changes
Browse files
app.py
CHANGED
|
@@ -60,7 +60,7 @@ class Config:
|
|
| 60 |
# Global clients
|
| 61 |
groq_client = None
|
| 62 |
qdrant_client = None
|
| 63 |
-
embedding_service =
|
| 64 |
|
| 65 |
@asynccontextmanager
|
| 66 |
async def lifespan(app: FastAPI):
|
|
@@ -76,7 +76,8 @@ async def lifespan(app: FastAPI):
|
|
| 76 |
api_key=Config.QDRANT_API_KEY
|
| 77 |
)
|
| 78 |
|
| 79 |
-
|
|
|
|
| 80 |
|
| 81 |
# Verify connections
|
| 82 |
try:
|
|
@@ -392,6 +393,7 @@ async def stream_chat_completion(messages: List[Dict], request: ChatCompletionRe
|
|
| 392 |
yield "data: [DONE]\n\n"
|
| 393 |
|
| 394 |
except Exception as e:
|
|
|
|
| 395 |
error_chunk = {
|
| 396 |
"error": {
|
| 397 |
"message": str(e),
|
|
|
|
| 60 |
# Global clients
|
| 61 |
groq_client = None
|
| 62 |
qdrant_client = None
|
| 63 |
+
embedding_service = EmbeddingService() # Initialize here
|
| 64 |
|
| 65 |
@asynccontextmanager
|
| 66 |
async def lifespan(app: FastAPI):
|
|
|
|
| 76 |
api_key=Config.QDRANT_API_KEY
|
| 77 |
)
|
| 78 |
|
| 79 |
+
# Initialize embedding service
|
| 80 |
+
embedding_service = None
|
| 81 |
|
| 82 |
# Verify connections
|
| 83 |
try:
|
|
|
|
| 393 |
yield "data: [DONE]\n\n"
|
| 394 |
|
| 395 |
except Exception as e:
|
| 396 |
+
print(f"Error in streaming: {e}")
|
| 397 |
error_chunk = {
|
| 398 |
"error": {
|
| 399 |
"message": str(e),
|