Skip to content

Commit 5e4a311

Browse files
committed
Fix GenAI tests
1 parent 2505b55 commit 5e4a311

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

server/genai/service/llm_client.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from fastapi import HTTPException, status
12
from abc import ABC, abstractmethod
23
from typing import List
34
from langchain_community.chat_models import ChatOpenAI
@@ -14,7 +15,7 @@ async def generate(self, prompts: List[str]) -> str:
1415
class OpenAIClient(AbstractLLMClient):
1516
def __init__(self, openai_api_key: str):
1617
if not openai_api_key:
17-
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!")
1819
self.client = ChatOpenAI(openai_api_key=openai_api_key)
1920

2021
async def generate(self, prompts: List[str]) -> str:

0 commit comments

Comments
 (0)