We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2505b55 commit 5e4a311Copy full SHA for 5e4a311
server/genai/service/llm_client.py
@@ -1,3 +1,4 @@
1
+from fastapi import HTTPException, status
2
from abc import ABC, abstractmethod
3
from typing import List
4
from langchain_community.chat_models import ChatOpenAI
@@ -14,7 +15,7 @@ async def generate(self, prompts: List[str]) -> str:
14
15
class OpenAIClient(AbstractLLMClient):
16
def __init__(self, openai_api_key: str):
17
if not openai_api_key:
- raise RuntimeError("OPENAI_API_KEY environment variable is missing or empty!")
18
+ raise HTTPException(status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail="OPENAI_API_KEY environment variable is missing or empty!")
19
self.client = ChatOpenAI(openai_api_key=openai_api_key)
20
21
async def generate(self, prompts: List[str]) -> str:
0 commit comments