methunraj
commited on
Commit
·
17e3d1d
1
Parent(s):
13c02b6
refactor(settings): update google api key environment variable name
Browse filesUpdate environment variable name from GOOGLE_AI_API_KEY to GOOGLE_API_KEY for consistency
Remove redundant api_key parameter from Gemini model initialization
Comment out unused GRADIO_SHARE and GRADIO_DEBUG environment variables
- Dockerfile +2 -2
- config/settings.py +3 -3
- settings.py +3 -3
- workflow/financial_workflow.py +3 -4
Dockerfile
CHANGED
|
@@ -102,8 +102,8 @@ RUN chown -R app:app /app \
|
|
| 102 |
ENV PYTHONPATH=/app
|
| 103 |
ENV GRADIO_SERVER_NAME=0.0.0.0
|
| 104 |
ENV GRADIO_SERVER_PORT=7860
|
| 105 |
-
ENV GRADIO_SHARE=false
|
| 106 |
-
ENV GRADIO_DEBUG=false
|
| 107 |
|
| 108 |
# Matplotlib configuration for headless operation
|
| 109 |
ENV MPLBACKEND=Agg
|
|
|
|
| 102 |
ENV PYTHONPATH=/app
|
| 103 |
ENV GRADIO_SERVER_NAME=0.0.0.0
|
| 104 |
ENV GRADIO_SERVER_PORT=7860
|
| 105 |
+
# ENV GRADIO_SHARE=false
|
| 106 |
+
# ENV GRADIO_DEBUG=false
|
| 107 |
|
| 108 |
# Matplotlib configuration for headless operation
|
| 109 |
ENV MPLBACKEND=Agg
|
config/settings.py
CHANGED
|
@@ -6,7 +6,7 @@ load_dotenv()
|
|
| 6 |
|
| 7 |
|
| 8 |
class Settings:
|
| 9 |
-
GOOGLE_AI_API_KEY = os.getenv("
|
| 10 |
MAX_FILE_SIZE_MB = 50
|
| 11 |
SUPPORTED_FILE_TYPES = [
|
| 12 |
"pdf",
|
|
@@ -46,8 +46,8 @@ class Settings:
|
|
| 46 |
|
| 47 |
@classmethod
|
| 48 |
def validate_config(cls):
|
| 49 |
-
if not cls.
|
| 50 |
-
raise ValueError("
|
| 51 |
cls.TEMP_DIR.mkdir(exist_ok=True)
|
| 52 |
|
| 53 |
|
|
|
|
| 6 |
|
| 7 |
|
| 8 |
class Settings:
|
| 9 |
+
GOOGLE_AI_API_KEY = os.getenv("GOOGLE_API_KEY")
|
| 10 |
MAX_FILE_SIZE_MB = 50
|
| 11 |
SUPPORTED_FILE_TYPES = [
|
| 12 |
"pdf",
|
|
|
|
| 46 |
|
| 47 |
@classmethod
|
| 48 |
def validate_config(cls):
|
| 49 |
+
if not cls.GOOGLE_API_KEY:
|
| 50 |
+
raise ValueError("GOOGLE_API_KEY required")
|
| 51 |
cls.TEMP_DIR.mkdir(exist_ok=True)
|
| 52 |
|
| 53 |
|
settings.py
CHANGED
|
@@ -6,7 +6,7 @@ load_dotenv()
|
|
| 6 |
|
| 7 |
|
| 8 |
class Settings:
|
| 9 |
-
GOOGLE_AI_API_KEY = os.getenv("
|
| 10 |
MAX_FILE_SIZE_MB = 50
|
| 11 |
SUPPORTED_FILE_TYPES = [
|
| 12 |
"pdf",
|
|
@@ -46,8 +46,8 @@ class Settings:
|
|
| 46 |
|
| 47 |
@classmethod
|
| 48 |
def validate_config(cls):
|
| 49 |
-
if not cls.
|
| 50 |
-
raise ValueError("
|
| 51 |
cls.TEMP_DIR.mkdir(exist_ok=True)
|
| 52 |
|
| 53 |
|
|
|
|
| 6 |
|
| 7 |
|
| 8 |
class Settings:
|
| 9 |
+
GOOGLE_AI_API_KEY = os.getenv("GOOGLE_API_KEY")
|
| 10 |
MAX_FILE_SIZE_MB = 50
|
| 11 |
SUPPORTED_FILE_TYPES = [
|
| 12 |
"pdf",
|
|
|
|
| 46 |
|
| 47 |
@classmethod
|
| 48 |
def validate_config(cls):
|
| 49 |
+
if not cls.GOOGLE_API_KEY:
|
| 50 |
+
raise ValueError("GOOGLE_API_KEY required")
|
| 51 |
cls.TEMP_DIR.mkdir(exist_ok=True)
|
| 52 |
|
| 53 |
|
workflow/financial_workflow.py
CHANGED
|
@@ -71,7 +71,7 @@ class FinancialDocumentWorkflow(Workflow):
|
|
| 71 |
|
| 72 |
# Data Extractor Agent - Structured output eliminates JSON parsing issues
|
| 73 |
data_extractor: Agent = Agent(
|
| 74 |
-
model=Gemini(id=settings.DATA_EXTRACTOR_MODEL,thinking_budget=settings.DATA_EXTRACTOR_MODEL_THINKING_BUDGET
|
| 75 |
description="Expert financial data extraction specialist",
|
| 76 |
instructions=[
|
| 77 |
"Extract comprehensive financial data from documents with these priorities:",
|
|
@@ -141,7 +141,7 @@ class FinancialDocumentWorkflow(Workflow):
|
|
| 141 |
|
| 142 |
# Data Arranger Agent - Organizes data into categories for Excel
|
| 143 |
data_arranger: Agent = Agent(
|
| 144 |
-
model=Gemini(id=settings.DATA_ARRANGER_MODEL,thinking_budget=settings.DATA_ARRANGER_MODEL_THINKING_BUDGET
|
| 145 |
description="Financial data organization and analysis expert",
|
| 146 |
instructions=[
|
| 147 |
'Organize the extracted financial data into logical categories based on financial statement types (Income Statement, Balance Sheet, Cash Flow Statement, etc.).',
|
|
@@ -181,8 +181,7 @@ class FinancialDocumentWorkflow(Workflow):
|
|
| 181 |
code_generator = Agent(
|
| 182 |
model=Gemini(
|
| 183 |
id=settings.CODE_GENERATOR_MODEL,
|
| 184 |
-
thinking_budget=settings.CODE_GENERATOR_MODEL_THINKING_BUDGET
|
| 185 |
-
api_key=settings.GOOGLE_AI_API_KEY
|
| 186 |
),
|
| 187 |
description="Excel report generator that analyzes JSON data and creates formatted workbooks using shell execution on any OS",
|
| 188 |
goal="Generate a professional Excel report from arranged_financial_data.json with multiple worksheets, formatting, and charts",
|
|
|
|
| 71 |
|
| 72 |
# Data Extractor Agent - Structured output eliminates JSON parsing issues
|
| 73 |
data_extractor: Agent = Agent(
|
| 74 |
+
model=Gemini(id=settings.DATA_EXTRACTOR_MODEL,thinking_budget=settings.DATA_EXTRACTOR_MODEL_THINKING_BUDGET),
|
| 75 |
description="Expert financial data extraction specialist",
|
| 76 |
instructions=[
|
| 77 |
"Extract comprehensive financial data from documents with these priorities:",
|
|
|
|
| 141 |
|
| 142 |
# Data Arranger Agent - Organizes data into categories for Excel
|
| 143 |
data_arranger: Agent = Agent(
|
| 144 |
+
model=Gemini(id=settings.DATA_ARRANGER_MODEL,thinking_budget=settings.DATA_ARRANGER_MODEL_THINKING_BUDGET),
|
| 145 |
description="Financial data organization and analysis expert",
|
| 146 |
instructions=[
|
| 147 |
'Organize the extracted financial data into logical categories based on financial statement types (Income Statement, Balance Sheet, Cash Flow Statement, etc.).',
|
|
|
|
| 181 |
code_generator = Agent(
|
| 182 |
model=Gemini(
|
| 183 |
id=settings.CODE_GENERATOR_MODEL,
|
| 184 |
+
thinking_budget=settings.CODE_GENERATOR_MODEL_THINKING_BUDGET
|
|
|
|
| 185 |
),
|
| 186 |
description="Excel report generator that analyzes JSON data and creates formatted workbooks using shell execution on any OS",
|
| 187 |
goal="Generate a professional Excel report from arranged_financial_data.json with multiple worksheets, formatting, and charts",
|