Commit
·
ccd9b6a
1
Parent(s):
9855392
Fix: version compatibility
Browse files- requirements.txt +3 -2
- src/services/groq_service.py +8 -2
requirements.txt
CHANGED
|
@@ -2,5 +2,6 @@ fastapi==0.104.1
|
|
| 2 |
uvicorn[standard]==0.24.0
|
| 3 |
pydantic==2.5.0
|
| 4 |
pydantic-settings==2.1.0
|
| 5 |
-
groq==0.
|
| 6 |
-
python-multipart==0.0.6
|
|
|
|
|
|
| 2 |
uvicorn[standard]==0.24.0
|
| 3 |
pydantic==2.5.0
|
| 4 |
pydantic-settings==2.1.0
|
| 5 |
+
groq==0.9.0
|
| 6 |
+
python-multipart==0.0.6
|
| 7 |
+
httpx==0.24.1
|
src/services/groq_service.py
CHANGED
|
@@ -14,9 +14,13 @@ class GroqService:
|
|
| 14 |
raise ValueError("GROQ_API_KEY environment variable is required")
|
| 15 |
|
| 16 |
try:
|
| 17 |
-
|
|
|
|
|
|
|
|
|
|
| 18 |
self.model = settings.groq_model
|
| 19 |
-
logger.info(f"✅ Groq client initialized
|
|
|
|
| 20 |
except Exception as e:
|
| 21 |
logger.error(f"❌ Failed to initialize Groq client: {str(e)}")
|
| 22 |
raise
|
|
@@ -27,6 +31,7 @@ class GroqService:
|
|
| 27 |
|
| 28 |
Args:
|
| 29 |
provider_notes: Clinical provider notes text
|
|
|
|
| 30 |
|
| 31 |
Returns:
|
| 32 |
dict: Parsed coding response with ICD-10, CPT codes and summary
|
|
@@ -86,6 +91,7 @@ class GroqService:
|
|
| 86 |
|
| 87 |
Args:
|
| 88 |
parsed_response: Raw parsed JSON from Groq
|
|
|
|
| 89 |
|
| 90 |
Returns:
|
| 91 |
dict: Properly structured response
|
|
|
|
| 14 |
raise ValueError("GROQ_API_KEY environment variable is required")
|
| 15 |
|
| 16 |
try:
|
| 17 |
+
# Simple initialization without extra parameters
|
| 18 |
+
self.client = Groq(
|
| 19 |
+
api_key=settings.groq_api_key
|
| 20 |
+
)
|
| 21 |
self.model = settings.groq_model
|
| 22 |
+
logger.info(f"✅ Groq client initialized successfully")
|
| 23 |
+
logger.info(f"✅ Using model: {self.model}")
|
| 24 |
except Exception as e:
|
| 25 |
logger.error(f"❌ Failed to initialize Groq client: {str(e)}")
|
| 26 |
raise
|
|
|
|
| 31 |
|
| 32 |
Args:
|
| 33 |
provider_notes: Clinical provider notes text
|
| 34 |
+
response_format: Desired response format (default: "json")
|
| 35 |
|
| 36 |
Returns:
|
| 37 |
dict: Parsed coding response with ICD-10, CPT codes and summary
|
|
|
|
| 91 |
|
| 92 |
Args:
|
| 93 |
parsed_response: Raw parsed JSON from Groq
|
| 94 |
+
response_format: Desired response format (default: "json")
|
| 95 |
|
| 96 |
Returns:
|
| 97 |
dict: Properly structured response
|