memra 0.2.13__py3-none-any.whl → 0.2.15__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- memra/cli.py +322 -51
- {memra-0.2.13.dist-info → memra-0.2.15.dist-info}/METADATA +1 -1
- {memra-0.2.13.dist-info → memra-0.2.15.dist-info}/RECORD +7 -61
- memra-0.2.15.dist-info/top_level.txt +1 -0
- memra-0.2.13.dist-info/top_level.txt +0 -4
- memra-ops/app.py +0 -808
- memra-ops/config/config.py +0 -25
- memra-ops/config.py +0 -34
- memra-ops/logic/__init__.py +0 -1
- memra-ops/logic/file_tools.py +0 -43
- memra-ops/logic/invoice_tools.py +0 -668
- memra-ops/logic/invoice_tools_fix.py +0 -66
- memra-ops/mcp_bridge_server.py +0 -1178
- memra-ops/scripts/check_database.py +0 -37
- memra-ops/scripts/clear_database.py +0 -48
- memra-ops/scripts/monitor_database.py +0 -67
- memra-ops/scripts/release.py +0 -133
- memra-ops/scripts/reset_database.py +0 -65
- memra-ops/scripts/start_memra.py +0 -334
- memra-ops/scripts/stop_memra.py +0 -132
- memra-ops/server_tool_registry.py +0 -190
- memra-ops/tests/test_llm_text_to_sql.py +0 -115
- memra-ops/tests/test_llm_vs_pattern.py +0 -130
- memra-ops/tests/test_mcp_schema_aware.py +0 -124
- memra-ops/tests/test_schema_aware_sql.py +0 -139
- memra-ops/tests/test_schema_aware_sql_simple.py +0 -66
- memra-ops/tests/test_text_to_sql_demo.py +0 -140
- memra-ops/tools/mcp_bridge_server.py +0 -851
- memra-sdk/examples/accounts_payable.py +0 -215
- memra-sdk/examples/accounts_payable_client.py +0 -217
- memra-sdk/examples/accounts_payable_mcp.py +0 -200
- memra-sdk/examples/ask_questions.py +0 -123
- memra-sdk/examples/invoice_processing.py +0 -116
- memra-sdk/examples/propane_delivery.py +0 -87
- memra-sdk/examples/simple_text_to_sql.py +0 -158
- memra-sdk/memra/__init__.py +0 -31
- memra-sdk/memra/discovery.py +0 -15
- memra-sdk/memra/discovery_client.py +0 -49
- memra-sdk/memra/execution.py +0 -481
- memra-sdk/memra/models.py +0 -99
- memra-sdk/memra/tool_registry.py +0 -343
- memra-sdk/memra/tool_registry_client.py +0 -106
- memra-sdk/scripts/release.py +0 -133
- memra-sdk/setup.py +0 -52
- memra-workflows/accounts_payable/accounts_payable.py +0 -215
- memra-workflows/accounts_payable/accounts_payable_client.py +0 -216
- memra-workflows/accounts_payable/accounts_payable_mcp.py +0 -200
- memra-workflows/accounts_payable/accounts_payable_smart.py +0 -221
- memra-workflows/invoice_processing/invoice_processing.py +0 -116
- memra-workflows/invoice_processing/smart_invoice_processor.py +0 -220
- memra-workflows/logic/__init__.py +0 -1
- memra-workflows/logic/file_tools.py +0 -50
- memra-workflows/logic/invoice_tools.py +0 -501
- memra-workflows/logic/propane_agents.py +0 -52
- memra-workflows/mcp_bridge_server.py +0 -230
- memra-workflows/propane_delivery/propane_delivery.py +0 -87
- memra-workflows/text_to_sql/complete_invoice_workflow_with_queries.py +0 -208
- memra-workflows/text_to_sql/complete_text_to_sql_system.py +0 -266
- memra-workflows/text_to_sql/file_discovery_demo.py +0 -156
- {memra-0.2.13.dist-info → memra-0.2.15.dist-info}/LICENSE +0 -0
- {memra-0.2.13.dist-info → memra-0.2.15.dist-info}/WHEEL +0 -0
- {memra-0.2.13.dist-info → memra-0.2.15.dist-info}/entry_points.txt +0 -0
@@ -1,66 +0,0 @@
|
|
1
|
-
def _build_schema_prompt(self, schema: Dict[str, Any]) -> str:
|
2
|
-
"""Build a prompt that includes the database schema"""
|
3
|
-
|
4
|
-
# Always return the schema-aware prompt
|
5
|
-
base_prompt = '''Extract invoice data from this image and return ONLY a JSON object with these specific fields:
|
6
|
-
- vendor_name: The company name at the top of the invoice
|
7
|
-
- invoice_number: The invoice number or ID
|
8
|
-
- invoice_date: The date the invoice was issued (YYYY-MM-DD format)
|
9
|
-
- total_amount: The total invoice amount
|
10
|
-
- line_items: Array of items with descriptions and amounts
|
11
|
-
|
12
|
-
Look specifically for the company/vendor name prominently displayed on the invoice.
|
13
|
-
|
14
|
-
Return ONLY valid JSON with no additional text or explanation.'''
|
15
|
-
|
16
|
-
# If no schema provided, return the base prompt
|
17
|
-
if not schema:
|
18
|
-
return base_prompt
|
19
|
-
|
20
|
-
# Handle the schema format sent by the client
|
21
|
-
if isinstance(schema, list):
|
22
|
-
# Client sends array of column objects
|
23
|
-
columns = schema
|
24
|
-
elif isinstance(schema, dict) and "columns" in schema:
|
25
|
-
# Standard format with columns array
|
26
|
-
columns = schema["columns"]
|
27
|
-
else:
|
28
|
-
# Fallback to base prompt
|
29
|
-
return base_prompt
|
30
|
-
|
31
|
-
# Build field descriptions from schema
|
32
|
-
field_descriptions = []
|
33
|
-
for col in columns:
|
34
|
-
# Handle both formats: {"column_name": "x"} and {"name": "x"}
|
35
|
-
name = col.get("column_name") or col.get("name", "")
|
36
|
-
col_type = col.get("data_type") or col.get("type", "")
|
37
|
-
|
38
|
-
# Skip system fields
|
39
|
-
if name and name not in ["id", "created_at", "updated_at", "status", "raw_json"]:
|
40
|
-
if name == "vendor_name":
|
41
|
-
field_descriptions.append(f"- {name}: The company name at the top of the invoice")
|
42
|
-
elif name == "invoice_number":
|
43
|
-
field_descriptions.append(f"- {name}: The invoice number or ID")
|
44
|
-
elif name == "invoice_date":
|
45
|
-
field_descriptions.append(f"- {name}: The date the invoice was issued (YYYY-MM-DD format)")
|
46
|
-
elif name == "total_amount":
|
47
|
-
field_descriptions.append(f"- {name}: The total invoice amount")
|
48
|
-
elif name == "due_date":
|
49
|
-
field_descriptions.append(f"- {name}: The invoice due date (YYYY-MM-DD format)")
|
50
|
-
elif name == "tax_amount":
|
51
|
-
field_descriptions.append(f"- {name}: The tax amount on the invoice")
|
52
|
-
elif name == "line_items":
|
53
|
-
field_descriptions.append(f"- {name}: Array of items with descriptions and amounts")
|
54
|
-
else:
|
55
|
-
field_descriptions.append(f"- {name}: {col_type}")
|
56
|
-
|
57
|
-
if field_descriptions:
|
58
|
-
schema_text = "\n".join(field_descriptions)
|
59
|
-
return f'''Extract invoice data from this image and return ONLY a JSON object with these specific fields:
|
60
|
-
{schema_text}
|
61
|
-
|
62
|
-
Look specifically for the company/vendor name prominently displayed on the invoice.
|
63
|
-
|
64
|
-
Return ONLY valid JSON with no additional text or explanation.'''
|
65
|
-
else:
|
66
|
-
return base_prompt
|