updated docs
This commit is contained in:
parent
66d5a87245
commit
4961b59186
14 changed files with 1153 additions and 403 deletions
Binary file not shown.
File diff suppressed because it is too large
Load diff
Binary file not shown.
|
|
@ -1,85 +0,0 @@
|
|||
STAKEHOLDER INTERVIEW TOBIAS
|
||||
|
||||
Date: 29 August 2025
|
||||
Attendees: Tobias, Pieter, Patrick, Jeroen
|
||||
|
||||
Agenda (60”):
|
||||
Framing & introductions (10” max.)
|
||||
Interview
|
||||
Next staps & wrap-up (5”)
|
||||
|
||||
Notes:
|
||||
Pieter’s introduction: charismatic, empathic, clear, concise, …
|
||||
Could be clearer on exact deliverables of the initiative
|
||||
Lighting is not optimal in Pieter’s room
|
||||
|
||||
Q2: E-mobility questions for managers from outside the BU E-mobility
|
||||
How well do you know E-mobility? Do you know the BU’s primary strategic targets?
|
||||
BOrn inSweden
|
||||
Mgmt consultant
|
||||
MSc Civil Engineering, nuclear domain & reactor, then treasury dept.
|
||||
Thomas based in Stockholm, his major team in Berlin
|
||||
Supporting 6 categories: solar, m&c, Finance, E-mobility, hydrogen
|
||||
17 FTE, 6 team leads and strateg. Buyers, junior buyers too to share load incl diversity
|
||||
I like procurement, because
|
||||
People , great team to lead
|
||||
In the center of transformation of industry (electrification)
|
||||
To contribute to better world
|
||||
|
||||
|
||||
What is the nature of your relationship with E-mobility?
|
||||
Before was category manager of BU E-Mob
|
||||
|
||||
|
||||
If at all, where and how can the collaboration between your team and E-mobility be elevated to a next level in service of Vattenfall?
|
||||
Closely integrated already, sometimes surprised about decision and direction to jeopardize current state, to identify short-termed changes
|
||||
Unclear changes on situations, short-term → difficult to adapt so fast to adapt better
|
||||
Example:_ batteries to integrate into chargers → grid connections and revenue as criteria; so different solutions which lead to pressure and short termed adaptions
|
||||
When handed over category manager role, one job was to NOT ACT until date fixed, so to prevent unused work → then acted on all initiatives, which overloads the team → creates informal leaders (Bastiaan de Jong vs. Stefano/Sven) → difficult situation then how to lead and give oversight → so to prepare answers wisely and having the pig picture, rather than just giving an answer
|
||||
Collaborative mood? - great collaboration in super atmosphere, “special persons” now away, psycho safety awareness in the team without hidden agenda. So good clean healthy communication. Always to improve for sure.
|
||||
To treat suppliers fair and neutral, some still preferring suppliers - this to be fixed → brand is in the core!
|
||||
|
||||
|
||||
|
||||
|
||||
Q3: Tech vision & framework
|
||||
This initiative aims to develop, implement and maintain the tech vision for BU E-mobility. How would you define a tech vision?
|
||||
Tech vision feels for me like engineering focus → i miss the link to the customer needs. No to bombard him with 1000 technical needs, away from he really wants
|
||||
Procurement can help focussing
|
||||
Capabilities to shape better, to focus on corporate strengths → to identify our USP
|
||||
We use a framework to cover all relevant aspects. What do you feel is missing if anything? SHOW THE STEERING WHEEL – SEE SLIDE 3
|
||||
Culture & strategy → not to underesimate CULTURE
|
||||
Customer to put more to FOCUS
|
||||
How strongly is digital transformation anchored in your procurement strategy, and what's your vision for procurement's role in the company's digital future?
|
||||
Category deep dive running now → WORK IN PROGRESS
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Catecory management tool, AI enabled: launched beginning of 2025, named: :-)
|
||||
|
||||
Q4: Procurement
|
||||
From your procurement expertise, how can strategic sourcing and supplier partnerships accelerate our business transformation?
|
||||
Procurement has a lot of experience and a time-tested framework when it comes to identifying and managing strategic suppliers (Fast-charging and AC suppliers) → Core values: Active, open, positive space
|
||||
ABB, Kempower, Alfen are already supported this way. The others can benefit from this
|
||||
What's your view on how procurement can enable innovation through digital supplier ecosystems and partnerships that benefit our core business?
|
||||
If our roadmap is clearly communicated we can piggyback on an enormous amount of R&D budget on suppliers side, so that we can influence their R&D agendas in a way that helps the BU to be successful → Could be a multiplier to our R&D budgets
|
||||
There is a lot of interest from the hardware team to explore many interesting possibilities, yet sometimes it feels like they are running without a compass.
|
||||
How can procurement's data and spend analytics provide insights that drive better business decisions across the organization?
|
||||
Procurement already has a supplier dashboard (SBTI - scientific based target initiative).
|
||||
Based on your experience, how should we engage procurement teams to ensure they're aligned with and supporting our business transformation goals?
|
||||
I have experienced that there was a bit more pushback for working with cat management. We now have a 5-point support approach, which has been time-tested. “Steal with pride”.
|
||||
What procurement-driven value creation opportunities do you see that could strengthen our overall business strategy and benefit our internal customers?
|
||||
Cooperation between Susanna Hurtig and Network Solutions was not helping in the past, lack of focussing on the bigger picture, that was annoying and I could not support that. Some individuals are still there and this has affected the relationships. Intercompany margins is not for procurement to get involved with.
|
||||
5. Conclusion:
|
||||
Anything else? Focus on Change Management → there is a lot going on within BU E-mobility. There may be a few who think “there we go again”. It is important to take that into account.
|
||||
|
||||
Do you have anything else to add in this context? Anything we missed?
|
||||
– change management to understand and to have a clear process
|
||||
|
||||
Interviewers: Thank the interviewee → Pieter
|
||||
|
||||
Binary file not shown.
|
|
@ -1,80 +0,0 @@
|
|||
STAKEHOLDER INTERVIEW ALIED
|
||||
|
||||
Date: 1 Sep 2025
|
||||
Attendees: Alied, Pieter, Patrick, Jeroen
|
||||
|
||||
Agenda (60”):
|
||||
Framing & introductions (10” max.)
|
||||
Interview
|
||||
Next steps & wrap-up (5”)
|
||||
|
||||
Potential AI use cases highlighted in pink.
|
||||
|
||||
Notes:
|
||||
…
|
||||
|
||||
2. Collaboration with DSH
|
||||
How satisfied are you currently with services and products provided by DSH?
|
||||
HW:, firmware, issues with it: Specialist in central team → to approach them
|
||||
Digital: Not aware of sprints, teams, structures → we depend on the systems to work, we have contact for issue to fix
|
||||
HW: I do not know, cooperation good, communication can be improved → not fully understanding each other
|
||||
Digital: A lot of things not delivered in time = serious issue → we are fast growing → more people using charge cards → automation not yet done
|
||||
Where and how can the collaboration between your team and DSH be elevated to a next level?
|
||||
Know structures & positions & cooperation model → overview & sync meetings per level
|
||||
Also issues regarding backoffice/frontoffice to arrange better → agreement and alignment of workflow, who does what to raise efficiency
|
||||
Asset mgmt team in NL working well, highest upsell; depend of central team, but also able to solve problems themselves
|
||||
I see progress in reducing blackbox by transparency
|
||||
|
||||
3. Tech vision & framework
|
||||
This initiative aims to develop, implement and maintain the tech vision for BU E-mobility. How would you define a tech vision?
|
||||
Needs to be clear, what is our strategy and approach. Choices to be clear
|
||||
To be flexible, or to be able to manage everything perfectly, or to listen to local demands, or is it defined centrally?
|
||||
To understand where landscape is going to with products, customers, using AI. Demand will increase, so also to think about where to invest for sales deals, complexity will raise with teams like NL, which are already on a high level. To identify low and high levels to FOCUS
|
||||
We use a framework to cover all relevant aspects. What do you feel is missing if anything?
|
||||
SHOW THE STEERING WHEEL – SEE SLIDE 3
|
||||
Topics there, that i would need
|
||||
What initiatives / trends / things are relevant for us to know from within S&O NL within this context?
|
||||
Growing demands from customers → do more on asset management, more reporting, more corrective actions
|
||||
Org: We need to run a lot of projects with centralized teams, so experts not to be project managers - not necessary a good idea (profile, roles)
|
||||
Competitors are ahead in of automation of asset management (incl getting cues on maintenance), efficiency → to ask them, to learn from them
|
||||
Have a prioritization mechanism
|
||||
How strongly is digital transformation anchored in NL strategy, and what's your vision for NL’s role in the BU’s digital future?
|
||||
We need to have people to challenge current processes and organisation, this plan/check/run to question again and again to enhance
|
||||
To reinvent every day work how to do
|
||||
CP’s are sending tonnes of info to the BU, and currently team translates this into actions for ops team. Here AI can help A LOT with automizing and prioritizing.
|
||||
If we have a bigger asset base, we need more people. But I believe this tech vision initiative in combo with customer experience, we can make a huge difference with AI.
|
||||
|
||||
4. NL
|
||||
Where do you see the current and future challenges for the BU and for NL (time-to-market; limited financial or human resources; increasing risks; regulatory requirements, etc.)?
|
||||
Market is a bit shaky: you want enough spare parts yet at the same time stay competitive (not being in exclusive partnerships)
|
||||
We are growing → Is our WoW sustainable when we grow bigger?
|
||||
Safety → Are we giving that sufficient attention?
|
||||
Where do you see the biggest challenges or success factors for successful tech vision implementation?
|
||||
Future → Market will be more and more regulated. Normally you have a reasonable time to implement changes. But a lot of stock is a risk here. (Alied has a background in regulatory affairs)
|
||||
How can NL’s data analytics provide insights that drive better business decisions across the organization?
|
||||
NL has a lot of operational knowledge from which this initiative can benefit a lot:
|
||||
We have a lot of big concessions, operating on a large scale compared to Germany / Sweden.
|
||||
We do a lot of AC, where other markets are more experienced in DC
|
||||
Based on your experience, how should we engage NL teams to ensure they're aligned with and supporting our business transformation goals?
|
||||
I would like an exchange: have someone from the hardware team to be a part of the NL team a day or two. And vice versa.
|
||||
What's your current degree of process automation, and which processes would create the most value if digitized?
|
||||
ALREADY ANSWERED
|
||||
What unique local requirements or opportunities do you see that could support DSH vision?
|
||||
Up-time: We are good at it because we are really on top of it. It is in the way we manage our maintenance partners, and how we take action on what we see.
|
||||
Sometimes people complain a lot about CP’s that aren’t working, but they take a pragmatic approach, focussing on what has biggest impact / value
|
||||
What is the biggest driver for these decisions?
|
||||
It is data-driven (from the system) plus experience
|
||||
What is good and should not be changed? What should be changed?
|
||||
My impression is that teams are really knowledgeable. Roles & resp should become more clear.
|
||||
Digital: Deliver on time, transparency and prove to have more understanding of how things look locally
|
||||
Hardware: Does not feel far away from me. AND it is also interesting to see the diff that specific people make. Great communicators are typically easy to work with.
|
||||
|
||||
5. Conclusion (5”)
|
||||
Do you have anything else to add in this context? Anything we missed?
|
||||
At a later stage talk to people like Rikus, Bob, Jasper, Justin
|
||||
Data quality is an issue. To know more about this talk to Justin (NL Ops, in team of Jasper)
|
||||
What does our system landscape look like, also with our direct stakeholders (municipalities, maintenance partners, etc.)? Some cues don’t reach us, because of an elaborate network of legacy systems tied together.
|
||||
PIETER: It might need that we may need to make (strategic) choices as part of this initiative. What choices do you see that we may need to make?
|
||||
If delivery on time is not up to par, we / you may need to choose to outsource. Rather than following Accenture’s advice from 2 years ago. Our competitors seem to choose to outsource (impression). We don’t know, we think our internal system is the best → specifically when it comes to the delivery of the digital team.
|
||||
Example: MLA project I was in conversation with an expert from digital - q was how much energy does it sell. But gov does not have interest in that , as up-time is the only thing they care about. He never heard about AC and how it really works
|
||||
|
||||
Binary file not shown.
|
|
@ -1,89 +0,0 @@
|
|||
STAKEHOLDER INTERVIEW FANNY
|
||||
|
||||
Date: 1 Sep 2025
|
||||
Attendees: Fanny, Pieter, Patrick, Jeroen
|
||||
|
||||
Agenda (60”):
|
||||
Framing & introductions (10” max.)
|
||||
Interview
|
||||
Next staps & wrap-up (5”)
|
||||
|
||||
Notes:
|
||||
…
|
||||
|
||||
|
||||
|
||||
Collaboration with DSH
|
||||
How satisfied are you currently with services and products provided by DSH?
|
||||
Services: Digital services criticised - low budget for what it needs. (led the digital team before)
|
||||
We were front runners 10 y ago, but now not there anymore in these days. A lot of legacy to carry. We became slow and get problems to keep our role in the market
|
||||
|
||||
|
||||
Where and how can the collaboration between your team and DSH be elevated to a next level?
|
||||
Collaboration: Ownership & capability - supplier is not just to lay back. Also to take LEADERSHIP, to define a subject - to play an active role. Here is a big opportunity - (in discussion). E.g. late status information about a product not ready
|
||||
People are all good, but GLUEING together is the topic
|
||||
|
||||
|
||||
3. Tech vision & framework
|
||||
This initiative aims to develop, implement and maintain the tech vision for BU E-mobility. How would you define a tech vision?
|
||||
I want to have out of a tech vision:
|
||||
A picture of enlarging tech, and how i can contribute
|
||||
How to implement tech, and WHAT to do, so how to ACT - -> To break it down, not just high level!
|
||||
We use a framework to cover all relevant aspects. What do you feel is missing if anything? SHOW THE STEERING WHEEL – SEE SLIDE 3
|
||||
We speak about a tech vision → but also vision how to manage AI. It is so much more than our products. Products only 20% - it touches everything!
|
||||
[CHALLENGE ACCEPTED]: Not AI on the bottom of the chart…. It is “everywhere”
|
||||
Make it to touch the base
|
||||
How can this technology enable us
|
||||
What initiatives / trends / things are relevant for us to know from within MCO within this context?
|
||||
Ops: Process documentation → TASK: Pieter to share
|
||||
AI: To use how to solve problems easier
|
||||
We have no usage on our journey, data not structured; to use data and workflows
|
||||
Current issue: Less vehicles sold, more stations built… this effect is critical → dumping prices, aggressive campaigns → vicious circle
|
||||
|
||||
|
||||
How strongly is digital transformation anchored in MCO strategy, and what's your vision for MCO’s role in the BU’s digital future?
|
||||
Operation lifecycl.
|
||||
|
||||
|
||||
MCO
|
||||
Where do you see the current and future challenges for the BU and for MCO (time-to-market; limited financial or human resources; increasing risks; regulatory requirements, etc.)?
|
||||
Usage is the main challenge
|
||||
EXPAND: First we need to expand value-wise → mainly usage, and later expand value pools
|
||||
EXCEL: More to do with internal operations (Pieter has the list). We concluded that we do a lot of manual tasks to day that customers can do themselves, and we need to support customers in that, also more preventative.
|
||||
Where do you see the biggest challenges or success factors for successful tech vision implementation?
|
||||
Usage is and will continue to be most critical
|
||||
We can reduce cost, but if we don’t generate income we don’t have a business
|
||||
Regulatory: We depend on subsidies for EV driving. Also, infrastructure costs (hardware, software) seem to be increasing
|
||||
In places, we may be running the risk of being too dependent on too few suppliers. EV infrastructure is now a nice-to-have
|
||||
How do you use customer data and analytics to improve targeting, personalization, and campaign effectiveness?
|
||||
We use both internal research expertise (from Ivo’s team) and consultancy. Next to that we have a large amount of data ourselves
|
||||
What's your current degree of process automation, and which MCO processes would create the most value if digitized?
|
||||
Compared to Vattenfall and the current state industry / in general: We are “somewhere in between”. Our core process seems to be ok.
|
||||
Example: Placing CP’s in the context of concessions, billing is automated (charge sessions rated and invoiced). 2 million sessions/month are all invoiced in a fully automated way
|
||||
Where we are not so good: We have many distributed assets. How to manage all these in an efficient centralised way
|
||||
Can be improved: Degree of self-service, dunning process, bad data quality leads to not being able to capture the money, contract management for CP’s (savings opportunity of 300K)
|
||||
Is it better to have centralized asset management?
|
||||
We are operating 70K CP’s in NL, Sweden and Germany. It is an art to be able to manage tech assets in a distributed way. It is not in the DNA of Vattenfall. At the same time margins are thinning
|
||||
How do you differentiate our offerings in the market, and what channels do you use to reach and engage customers throughout their journey?
|
||||
We mainly use traditional channels: Meta, Google, LinkedIn. Sometimes through our partners (like Max Hamburgers, Netto - with Netto it is not so much a match ito branding), less so
|
||||
Differentiation:
|
||||
We do the placement in urban concessions better than others, we do what we say and don’t overpromise. We largely deliver on time and within budget
|
||||
In other segments, we don’t do so much but leverage our trusted Vattenfall brand
|
||||
Quality is not (yet/anymore) a differentiating factor
|
||||
How do you collect and act on customer feedback, and would it be possible for you to give us inputs on your strategies for digital channels?
|
||||
Until now this is very scattered. We now have 1 person who is collecting who is doing what where
|
||||
Digital channels: On LinkedIn we run campaigns. On Google we do Google maps (listing charging stations), including selected paid geo-targeted campaigns. Meta - not sure. Microsoft - nothing currently.
|
||||
Not using our InCharge app due to technical reasons
|
||||
Direct comms: InCharge newsletters, Vattenfall’s newsletter
|
||||
What is good and should not be changed? What should be changed?
|
||||
Change:
|
||||
Adopt strategies to drive people to use our stations
|
||||
Easiness with which we do process improvements. Technical as well
|
||||
Aligned energy. Not only “puppy energy”, but balanced with senior grounded energy that allows us to consolidate. We are in a diff market state now, we are not a startup anymore
|
||||
Not change:
|
||||
International approach - Central setup
|
||||
Serving our owner with the quality that they require (sometimes boring, but also very clear)
|
||||
|
||||
5. Conclusion (5”)
|
||||
Do you have anything else to add in this context? Anything we missed?
|
||||
I appreciate strategies, visions, roadmaps that are tangible → WHAT WILL WE ACTUALLY DO
|
||||
Binary file not shown.
|
|
@ -0,0 +1,114 @@
|
|||
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
|
||||
433
poweron/appdoc/centralized_ai_calls_specification.md
Normal file
433
poweron/appdoc/centralized_ai_calls_specification.md
Normal file
|
|
@ -0,0 +1,433 @@
|
|||
# Centralized AI Calls Specification
|
||||
|
||||
## Overview
|
||||
|
||||
This document specifies the centralized AI call system for PowerOn, replacing the current distributed AI call patterns with a unified approach that provides better optimization, consistency, and maintainability.
|
||||
|
||||
## Current State Analysis
|
||||
|
||||
### Existing AI Call Patterns
|
||||
|
||||
The current codebase uses multiple AI call patterns across different modules:
|
||||
|
||||
1. **ServiceCenter** - Basic/Advanced text and image processing
|
||||
2. **HandlingTasks** - Task planning, action planning, result validation
|
||||
3. **MethodOutlook** - Email composition with document context
|
||||
4. **MethodAi** - General AI processing with document context
|
||||
5. **MethodDocument** - HTML report generation and document conversion
|
||||
|
||||
### Current Implementation Issues
|
||||
|
||||
- **Inconsistent Model Selection**: Different modules use different AI models without optimization
|
||||
- **Redundant Document Processing**: Each module implements its own document extraction logic
|
||||
- **No Centralized Optimization**: No unified approach to content compression or failover
|
||||
- **Maintenance Overhead**: Changes to AI logic require updates across multiple modules
|
||||
|
||||
## Centralized AI Call System
|
||||
|
||||
### Core Interface
|
||||
|
||||
```python
|
||||
async def callAi(
|
||||
prompt: str,
|
||||
documents: List[ChatDocument] = None,
|
||||
options: Dict[str, Any] = None
|
||||
) -> CentralizedAiResponse
|
||||
```
|
||||
|
||||
### Options Specification
|
||||
|
||||
```python
|
||||
options = {
|
||||
"process_type": "text" | "image", # Content type to process
|
||||
"operation_type": "generate_plan" | "summarize_data" | "extract_content" | "analyse_content" | "generate_content" | "email_composition" | "report_generation" | "task_planning" | "result_validation",
|
||||
"priority": "speed" | "quality" | "cost" | "balanced", # Model selection priority
|
||||
"compress_prompt": bool, # Allow prompt compression
|
||||
"compress_documents": bool, # Allow document compression
|
||||
"process_documents_individually": bool, # Process documents separately
|
||||
"max_cost": float, # Maximum cost limit
|
||||
"max_processing_time": int, # Max processing time in seconds
|
||||
"max_size_bytes": int, # Maximum result size
|
||||
"result_format_requested": str, # Desired output format
|
||||
"include_metadata": bool, # Include document metadata
|
||||
"processing_mode": "basic" | "advanced" | "detailed" # Processing depth
|
||||
}
|
||||
```
|
||||
|
||||
### Response Format
|
||||
|
||||
The centralized AI call returns a standardized `CentralizedAiResponse` object:
|
||||
|
||||
```python
|
||||
class CentralizedAiResponse(BaseModel):
|
||||
aiResults: List[AiResult] = Field(default_factory=list)
|
||||
success: bool = Field(description="Whether the AI call was successful")
|
||||
error: Optional[str] = Field(None, description="Error message if the call failed")
|
||||
|
||||
class AiResult(BaseModel):
|
||||
filename: str = Field(description="Name of the result document")
|
||||
mimetype: str = Field(description="MIME type of the result document")
|
||||
content: str = Field(description="Content of the result document")
|
||||
```
|
||||
|
||||
## Current AI Calls Mapping
|
||||
|
||||
### 1. ServiceCenter AI Calls
|
||||
|
||||
#### Functions to DELETE from ServiceCenter
|
||||
```python
|
||||
# DELETE these functions from ServiceCenter:
|
||||
async def callAiTextBasic(self, prompt: str, context: str = None) -> str
|
||||
async def callAiTextAdvanced(self, prompt: str, context: str = None) -> str
|
||||
async def callAiImageBasic(self, prompt: str, imageData: str, mimeType: str) -> str
|
||||
async def callAiImageAdvanced(self, prompt: str, imageData: str, mimeType: str) -> str
|
||||
async def extractContentFromDocument(self, prompt: str, document: ChatDocument) -> ExtractedContent
|
||||
```
|
||||
|
||||
#### Direct Centralized Replacement - All calls go directly to interfaceAiCalls
|
||||
```python
|
||||
# Basic text processing - Direct call with speed priority
|
||||
response = await self.service.interfaceAiCalls.callAi(
|
||||
prompt=prompt,
|
||||
documents=None,
|
||||
options={
|
||||
"process_type": "text",
|
||||
"operation_type": "generate_content",
|
||||
"priority": "speed",
|
||||
"compress_prompt": True,
|
||||
"compress_documents": False,
|
||||
"max_cost": 0.01
|
||||
}
|
||||
)
|
||||
# Access result: response.aiResults, response.success, response.error
|
||||
|
||||
# Advanced text processing - Direct call with quality priority
|
||||
response = await self.service.interfaceAiCalls.callAi(
|
||||
prompt=prompt,
|
||||
documents=None,
|
||||
options={
|
||||
"process_type": "text",
|
||||
"operation_type": "generate_content",
|
||||
"priority": "quality",
|
||||
"compress_prompt": False,
|
||||
"compress_documents": False,
|
||||
"max_cost": 0.05
|
||||
}
|
||||
)
|
||||
# Access result: response.aiResults, response.success, response.error
|
||||
|
||||
# Image processing - Direct call with image documents
|
||||
image_doc = ChatDocument(fileData=imageData, fileName="image", mimeType=mimeType)
|
||||
response = await self.service.interfaceAiCalls.callAi(
|
||||
prompt=prompt,
|
||||
documents=[image_doc],
|
||||
options={
|
||||
"process_type": "image",
|
||||
"operation_type": "analyse_content",
|
||||
"priority": "balanced",
|
||||
"compress_documents": True,
|
||||
"max_cost": 0.03
|
||||
}
|
||||
)
|
||||
# Access result: response.aiResults, response.success, response.error
|
||||
```
|
||||
|
||||
### 2. HandlingTasks AI Calls
|
||||
|
||||
#### Current Implementation (TO BE REMOVED)
|
||||
```python
|
||||
# Task planning
|
||||
prompt = await self.service.callAiTextAdvanced(task_planning_prompt)
|
||||
|
||||
# Action planning
|
||||
prompt = await self.service.callAiTextAdvanced(action_prompt)
|
||||
|
||||
# Result validation
|
||||
response = await self.service.callAiTextAdvanced(prompt)
|
||||
```
|
||||
|
||||
#### Direct Centralized Replacement
|
||||
```python
|
||||
# Task planning - Direct call with detailed processing
|
||||
response = await self.service.interfaceAiCalls.callAi(
|
||||
prompt=task_planning_prompt,
|
||||
documents=None,
|
||||
options={
|
||||
"process_type": "text",
|
||||
"operation_type": "generate_plan",
|
||||
"priority": "quality",
|
||||
"compress_prompt": False,
|
||||
"compress_documents": False,
|
||||
"processing_mode": "detailed",
|
||||
"max_cost": 0.10,
|
||||
"max_processing_time": 60
|
||||
}
|
||||
)
|
||||
# Access result: response.aiResults[0].content for the plan text
|
||||
|
||||
# Action planning - Direct call with detailed processing
|
||||
response = await self.service.interfaceAiCalls.callAi(
|
||||
prompt=action_prompt,
|
||||
documents=None,
|
||||
options={
|
||||
"process_type": "text",
|
||||
"operation_type": "generate_plan",
|
||||
"priority": "quality",
|
||||
"compress_prompt": False,
|
||||
"compress_documents": False,
|
||||
"processing_mode": "detailed",
|
||||
"max_cost": 0.10,
|
||||
"max_processing_time": 60
|
||||
}
|
||||
)
|
||||
# Access result: response.aiResults[0].content for the action plan
|
||||
|
||||
# Result validation - Direct call with analysis focus
|
||||
response = await self.service.interfaceAiCalls.callAi(
|
||||
prompt=prompt,
|
||||
documents=None,
|
||||
options={
|
||||
"process_type": "text",
|
||||
"operation_type": "analyse_content",
|
||||
"priority": "balanced",
|
||||
"compress_prompt": True,
|
||||
"compress_documents": False,
|
||||
"processing_mode": "advanced",
|
||||
"max_cost": 0.05,
|
||||
"max_processing_time": 30
|
||||
}
|
||||
)
|
||||
# Access result: response.aiResults[0].content for the validation result
|
||||
```
|
||||
|
||||
### 3. MethodOutlook AI Calls
|
||||
|
||||
#### Current Implementation (TO BE REMOVED)
|
||||
```python
|
||||
# Document extraction
|
||||
extracted_content = await self.service.extractContentFromDocument(
|
||||
prompt="Extract readable text content for email composition",
|
||||
document=doc
|
||||
)
|
||||
|
||||
# Email composition
|
||||
composed_email = await self.service.callAiTextAdvanced(ai_prompt)
|
||||
```
|
||||
|
||||
#### Direct Centralized Replacement
|
||||
```python
|
||||
# Email composition with document context - Direct call
|
||||
response = await self.service.interfaceAiCalls.callAi(
|
||||
prompt=ai_prompt,
|
||||
documents=documents,
|
||||
options={
|
||||
"process_type": "text",
|
||||
"operation_type": "email_composition",
|
||||
"priority": "speed",
|
||||
"compress_prompt": True,
|
||||
"compress_documents": True,
|
||||
"process_documents_individually": False,
|
||||
"result_format_requested": "email",
|
||||
"include_metadata": True,
|
||||
"max_cost": 0.02,
|
||||
"max_processing_time": 15
|
||||
}
|
||||
)
|
||||
# Access result: response.aiResults[0].content for the email content
|
||||
# response.aiResults[0].mimetype will contain the MIME type of the delivered content
|
||||
```
|
||||
|
||||
### 4. MethodAi AI Calls
|
||||
|
||||
#### Current Implementation (TO BE REMOVED)
|
||||
```python
|
||||
# Document extraction
|
||||
extracted_content = await self.service.extractContentFromDocument(
|
||||
prompt=extraction_prompt,
|
||||
document=doc
|
||||
)
|
||||
|
||||
# AI processing
|
||||
if processingMode in ["advanced", "detailed"]:
|
||||
result = await self.service.callAiTextAdvanced(enhanced_prompt, context)
|
||||
else:
|
||||
result = await self.service.callAiTextBasic(enhanced_prompt, context)
|
||||
```
|
||||
|
||||
#### Direct Centralized Replacement
|
||||
```python
|
||||
# AI processing with document context - Direct call
|
||||
response = await self.service.interfaceAiCalls.callAi(
|
||||
prompt=enhanced_prompt,
|
||||
documents=documents,
|
||||
options={
|
||||
"process_type": "text",
|
||||
"operation_type": "generate_content",
|
||||
"priority": "quality" if processingMode in ["advanced", "detailed"] else "speed",
|
||||
"compress_prompt": processingMode != "detailed",
|
||||
"compress_documents": True,
|
||||
"process_documents_individually": True,
|
||||
"processing_mode": processingMode,
|
||||
"result_format_requested": output_format,
|
||||
"include_metadata": includeMetadata,
|
||||
"max_cost": 0.05 if processingMode in ["advanced", "detailed"] else 0.02,
|
||||
"max_processing_time": 45 if processingMode in ["advanced", "detailed"] else 20
|
||||
}
|
||||
)
|
||||
# Access result: response.aiResults for all generated documents
|
||||
# Each aiResult.mimetype will contain the MIME type of the delivered content
|
||||
```
|
||||
|
||||
### 5. MethodDocument AI Calls
|
||||
|
||||
#### Current Implementation (TO BE REMOVED)
|
||||
```python
|
||||
# Document extraction for HTML report
|
||||
extracted_content = await self.service.extractContentFromDocument(
|
||||
prompt="Extract readable text content for HTML report generation",
|
||||
document=doc
|
||||
)
|
||||
|
||||
# HTML report generation
|
||||
aiReport = await self.service.callAiTextBasic(aiPrompt, combinedContent)
|
||||
```
|
||||
|
||||
#### Direct Centralized Replacement
|
||||
```python
|
||||
# HTML report generation with document context - Direct call
|
||||
response = await self.service.interfaceAiCalls.callAi(
|
||||
prompt=aiPrompt,
|
||||
documents=documents,
|
||||
options={
|
||||
"process_type": "text",
|
||||
"operation_type": "report_generation",
|
||||
"priority": "quality",
|
||||
"compress_prompt": False,
|
||||
"compress_documents": True,
|
||||
"process_documents_individually": True,
|
||||
"result_format_requested": "html",
|
||||
"include_metadata": includeMetadata,
|
||||
"processing_mode": "detailed",
|
||||
"max_cost": 0.08,
|
||||
"max_processing_time": 90
|
||||
}
|
||||
)
|
||||
# Access result: response.aiResults[0].content for the HTML report
|
||||
# response.aiResults[0].mimetype will contain the MIME type of the delivered content
|
||||
```
|
||||
|
||||
## Document Processing Integration
|
||||
|
||||
### Centralized Document Extraction
|
||||
|
||||
The centralized system integrates with `DocumentExtraction.processFileData()` for all document processing:
|
||||
|
||||
```python
|
||||
# Document extraction is handled automatically by the centralized callAi method
|
||||
# No need for manual extractContentFromDocument calls
|
||||
```
|
||||
|
||||
### Document Processing Options
|
||||
|
||||
- **Individual Processing**: Each document processed separately with its own context
|
||||
- **Batch Processing**: All documents processed together for comprehensive analysis
|
||||
- **Metadata Inclusion**: Optional inclusion of file metadata (size, type, etc.)
|
||||
- **Content Compression**: Automatic compression for large documents
|
||||
|
||||
## Technical Benefits
|
||||
|
||||
- **Unified Model Selection**: Automatic selection based on content size, operation type, and priority
|
||||
- **Consistent Document Processing**: Single point of document extraction logic
|
||||
- **Content Compression**: Automatic compression for large prompts and documents
|
||||
- **Centralized Error Handling**: Consistent error handling and logging across all AI operations
|
||||
|
||||
## Migration Strategy
|
||||
|
||||
### Phase 1: Direct Call Implementation
|
||||
- Replace all `callAiTextBasic/Advanced` calls with direct `interfaceAiCalls.callAi()` calls
|
||||
- Remove intermediate wrapper functions
|
||||
- Each AI call gets specific options tailored to its needs
|
||||
|
||||
### Phase 2: DELETE Legacy Methods from ServiceCenter
|
||||
- **DELETE** `callAiTextBasic`, `callAiTextAdvanced`, `callAiImageBasic`, `callAiImageAdvanced` methods from ServiceCenter
|
||||
- **DELETE** `extractContentFromDocument` method from ServiceCenter (handled automatically by centralized system)
|
||||
- Update all modules to use direct `self.service.interfaceAiCalls.callAi()` calls
|
||||
|
||||
### Phase 3: Optimize and Test
|
||||
- Fine-tune options for each specific use case
|
||||
- Add comprehensive testing for all AI call scenarios
|
||||
- Monitor performance and cost optimization
|
||||
|
||||
### Phase 4: Documentation and Cleanup
|
||||
- Update all documentation to reflect direct call approach
|
||||
- Remove any remaining legacy code references
|
||||
- Finalize centralized AI call patterns
|
||||
|
||||
## Configuration Examples
|
||||
|
||||
### High-Quality Document Analysis
|
||||
```python
|
||||
options = {
|
||||
"process_type": "text",
|
||||
"operation_type": "analyse_content",
|
||||
"priority": "quality",
|
||||
"compress_prompt": False,
|
||||
"compress_documents": False,
|
||||
"process_documents_individually": True,
|
||||
"include_metadata": True,
|
||||
"processing_mode": "detailed"
|
||||
}
|
||||
# Response: response.aiResults[0].content contains analysis
|
||||
```
|
||||
|
||||
### Fast Email Composition
|
||||
```python
|
||||
options = {
|
||||
"process_type": "text",
|
||||
"operation_type": "email_composition",
|
||||
"priority": "speed",
|
||||
"compress_prompt": True,
|
||||
"compress_documents": True,
|
||||
"result_format_requested": "email",
|
||||
"max_cost": 0.10
|
||||
}
|
||||
# Response: response.aiResults[0].content contains email
|
||||
# response.aiResults[0].mimetype shows the MIME type of delivered content
|
||||
```
|
||||
|
||||
### Cost-Optimized Report Generation
|
||||
```python
|
||||
options = {
|
||||
"process_type": "text",
|
||||
"operation_type": "report_generation",
|
||||
"priority": "cost",
|
||||
"compress_prompt": True,
|
||||
"compress_documents": True,
|
||||
"result_format_requested": "html",
|
||||
"max_cost": 0.05,
|
||||
"max_processing_time": 30
|
||||
}
|
||||
# Response: response.aiResults[0].content contains HTML report
|
||||
# response.aiResults[0].mimetype shows the MIME type of delivered content
|
||||
```
|
||||
|
||||
## Implementation Requirements
|
||||
|
||||
### **Direct Interface Usage**
|
||||
All AI calls must use:
|
||||
```python
|
||||
await self.service.interfaceAiCalls.callAi(prompt, documents, options)
|
||||
```
|
||||
|
||||
### **Functions to Remove**
|
||||
- `self.service.callAiTextBasic()`
|
||||
- `self.service.callAiTextAdvanced()`
|
||||
- `self.service.callAiImageBasic()`
|
||||
- `self.service.callAiImageAdvanced()`
|
||||
- `self.service.extractContentFromDocument()`
|
||||
|
||||
### **Configuration per Use Case**
|
||||
- **Task Planning**: Quality priority, detailed processing, 60s timeout
|
||||
- **Email Composition**: Speed priority, compressed content, 15s timeout
|
||||
- **Report Generation**: Quality priority, detailed processing, 90s timeout
|
||||
- **Image Analysis**: Balanced priority, compressed documents
|
||||
Loading…
Reference in a new issue