Spaces:
Sleeping
Sleeping
inital requirements
Browse files- claims_agent.py +7 -5
- requirements.txt +1 -1
claims_agent.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
import os
|
| 2 |
-
|
| 3 |
from dotenv import load_dotenv
|
| 4 |
from PIL import Image
|
| 5 |
|
|
@@ -11,8 +11,7 @@ class ClaimsIntakeAgent:
|
|
| 11 |
if not api_key:
|
| 12 |
print("Warning: GEMINI_API_KEY not found in environment variables.")
|
| 13 |
else:
|
| 14 |
-
genai.
|
| 15 |
-
self.model = genai.GenerativeModel('gemini-2.5-flash')
|
| 16 |
|
| 17 |
def process_claim(self, user_input, image=None, document_path=None):
|
| 18 |
"""
|
|
@@ -24,7 +23,7 @@ class ClaimsIntakeAgent:
|
|
| 24 |
Returns:
|
| 25 |
str: The agent's response.
|
| 26 |
"""
|
| 27 |
-
if not hasattr(self, '
|
| 28 |
return "Error: Gemini API key not configured. Please check your .env file."
|
| 29 |
|
| 30 |
from utils import convert_doc_to_markdown
|
|
@@ -65,7 +64,10 @@ class ClaimsIntakeAgent:
|
|
| 65 |
if image:
|
| 66 |
inputs.append(image)
|
| 67 |
|
| 68 |
-
response = self.
|
|
|
|
|
|
|
|
|
|
| 69 |
return response.text
|
| 70 |
except Exception as e:
|
| 71 |
return f"Error processing claim: {str(e)}"
|
|
|
|
| 1 |
import os
|
| 2 |
+
from google import genai
|
| 3 |
from dotenv import load_dotenv
|
| 4 |
from PIL import Image
|
| 5 |
|
|
|
|
| 11 |
if not api_key:
|
| 12 |
print("Warning: GEMINI_API_KEY not found in environment variables.")
|
| 13 |
else:
|
| 14 |
+
self.client = genai.Client(api_key=api_key)
|
|
|
|
| 15 |
|
| 16 |
def process_claim(self, user_input, image=None, document_path=None):
|
| 17 |
"""
|
|
|
|
| 23 |
Returns:
|
| 24 |
str: The agent's response.
|
| 25 |
"""
|
| 26 |
+
if not hasattr(self, 'client'):
|
| 27 |
return "Error: Gemini API key not configured. Please check your .env file."
|
| 28 |
|
| 29 |
from utils import convert_doc_to_markdown
|
|
|
|
| 64 |
if image:
|
| 65 |
inputs.append(image)
|
| 66 |
|
| 67 |
+
response = self.client.models.generate_content(
|
| 68 |
+
model='gemini-2.5-flash',
|
| 69 |
+
contents=inputs
|
| 70 |
+
)
|
| 71 |
return response.text
|
| 72 |
except Exception as e:
|
| 73 |
return f"Error processing claim: {str(e)}"
|
requirements.txt
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
-
google-
|
| 2 |
python-dotenv
|
| 3 |
markitdown
|
|
|
|
| 1 |
+
google-genai
|
| 2 |
python-dotenv
|
| 3 |
markitdown
|