-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
57 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
"""LLM module for patients API.""" | ||
|
||
import logging | ||
import os | ||
|
||
from langchain_openai import ChatOpenAI | ||
|
||
|
||
# Configure logging | ||
logging.basicConfig(level=logging.INFO) | ||
logger = logging.getLogger(__name__) | ||
|
||
# Set up OpenAI client with custom endpoint | ||
LLM_SERVICE_URL = os.getenv("LLM_SERVICE_URL") | ||
if not LLM_SERVICE_URL: | ||
raise ValueError("LLM_SERVICE_URL is not set") | ||
logger.info(f"LLM_SERVICE_URL is set to: {LLM_SERVICE_URL}") | ||
|
||
os.environ["OPENAI_API_KEY"] = "EMPTY" | ||
|
||
# Initialize LLM with increased timeout | ||
try: | ||
LLM = ChatOpenAI( | ||
base_url=LLM_SERVICE_URL, | ||
model_name="Meta-Llama-3.1-70B-Instruct", | ||
temperature=0.3, | ||
max_tokens=4096, | ||
request_timeout=60, | ||
) | ||
logger.info("ChatOpenAI initialized successfully") | ||
except Exception as e: | ||
logger.error(f"Error initializing ChatOpenAI: {str(e)}") | ||
raise |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
"""EHR workflow functions.""" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters