114 lines
4.8 KiB
Text
114 lines
4.8 KiB
Text
I want to have one centralized procedure to handle all ai calls with documents.
|
|
Based on specification below, can you check in the code the current different AI calls in section "AI calls usage in the code"
|
|
and formulate the according calls to use centralized ai calls with prompt, documents, options by defining the options for each call and the other parameters to keep current logic.
|
|
|
|
first show me the calls in the chat.
|
|
|
|
|
|
|
|
SPECIFICATION
|
|
|
|
# AI Calls
|
|
|
|
Key Features:
|
|
- Model selection based on priority (speed/quality/balanced)
|
|
- Content compression for large prompts
|
|
- Failover between models
|
|
- Specialized methods for different operations
|
|
|
|
Params:
|
|
prompt (mandatory)
|
|
documents
|
|
options{
|
|
process_type: Optionen ("image", "text")
|
|
operation_type: Optionen ("generate_plan","summarize_data","extract_content","analyse_content","generate_content")
|
|
priority: Priorität für Modell-Auswahl ("speed", "quality", "cost", "balanced")
|
|
compress_prompt: Ob der Prompt komprimiert werden darf
|
|
compress_documents: Ob Dokumente komprimiert werden darf
|
|
process_documents_individually: Ob Dokumente einzeln verarbeitet werden dürfen
|
|
max_cost: Maximale Kosten für den Call
|
|
max_processing_time: Maximale Verarbeitungszeit in Sekunden
|
|
max_size_bytes: Maximale Grösse des resultierenden Dokuments
|
|
}
|
|
|
|
Centralized content extraction:
|
|
- For extraction this call is done: ServiceCenter.extractContentFromDocument(documents, docPrompt) --> calls DocumentExtraction.processFileData
|
|
|
|
AI procedure:
|
|
1. define docPrompt:
|
|
- to deliver content to be used for actionPrompt
|
|
- to define output in a text format, all contents as text in a json structure
|
|
2. extraction(documents, docPrompt) -> json(contents with the metadata of the original document and file)
|
|
3. define callPrompt
|
|
- CUSTOM: to define callPrompt with integrating actionPrompt
|
|
- to include in the prompt, if target format is not possible to deliver, to deliver another format
|
|
- to including resultDocumentFormatRequested in actionPrompt, and resultDocumentFormatDelivered
|
|
- to define to deliver result document in resultDocumentFormatDelivered
|
|
4. AI(callPrompt + json) -> resultDocumentFormatDelivered
|
|
|
|
|
|
|
|
# AI calls usage in the code
|
|
|
|
## MethodOutlook
|
|
|
|
emailComposition:
|
|
1. define docPrompt:
|
|
- to deliver content to be used for actionPrompt
|
|
- to define output in a text format, all contents as text in a json structure
|
|
2. extraction(documents, docPrompt) -> json(contents with the metadata of the original document and file)
|
|
3. define callPrompt
|
|
- CUSTOM: to define callPrompt with integrating actionPrompt
|
|
- to include in the prompt, if target format is not possible to deliver, to deliver another format
|
|
- to including resultDocumentFormatRequested in actionPrompt, and resultDocumentFormatDelivered
|
|
- to define to deliver result document in resultDocumentFormatDelivered
|
|
4. AI(callPrompt + json) -> resultDocumentFormatDelivered
|
|
|
|
|
|
## MethodAi
|
|
|
|
callAi:
|
|
1. define docPrompt:
|
|
- to deliver content to be used for actionPrompt
|
|
- to define output in a text format, all contents as text in a json structure
|
|
2. extraction(documents, docPrompt) -> json(contents with the metadata of the original document and file)
|
|
3. define callPrompt
|
|
- CUSTOM: to define callPrompt with integrating actionPrompt
|
|
- to include in the prompt, if target format is not possible to deliver, to deliver another format
|
|
- to including resultDocumentFormatRequested in actionPrompt, and resultDocumentFormatDelivered
|
|
- to define to deliver result document in resultDocumentFormatDelivered
|
|
4. AI(callPrompt + json) -> resultDocumentFormatDelivered
|
|
|
|
|
|
|
|
## MethodDocument
|
|
|
|
Generate HTML report:
|
|
1. define docPrompt:
|
|
- to deliver content to be used for actionPrompt
|
|
- to define output in a text format, all contents as text in a json structure
|
|
2. extraction(documents, docPrompt) -> json(contents with the metadata of the original document and file)
|
|
3. define callPrompt
|
|
- CUSTOM: to define callPrompt with integrating actionPrompt
|
|
- to include in the prompt, if target format is not possible to deliver, to deliver another format
|
|
- to including resultDocumentFormatRequested in actionPrompt, and resultDocumentFormatDelivered
|
|
- to define to deliver result document in resultDocumentFormatDelivered
|
|
4. AI(callPrompt + json) -> resultDocumentFormatDelivered
|
|
|
|
Convert documents between formats (CSV, JSON, XML, HTML, Markdown):
|
|
--> TO REMOVE, AS INTEGRATED NOW IN THE GENERAL LOGIC IN callPrompt
|
|
|
|
|
|
|
|
|
|
# Centralized components
|
|
|
|
## DocumentExtraction
|
|
- Extract content from images using AI vision with prompt and file
|
|
- Process text content with AI for better extraction with prompt and file
|
|
- Handle different document types intelligently --> UNCLEAR
|
|
|
|
## HandlingTasks
|
|
- Generate task plan with complex prompt, no documents
|
|
- Generate action plan with complex prompt, no documents
|
|
- Validate result with complex prompt, no documents
|