Spaces:
Sleeping
Sleeping
Download src/workflow.py from esturban/mgmt-consulting: direct link, hf CLI and curl.
- Browser
- Download file 774 Bytes
-
https://huggingface.co/spaces/esturban/mgmt-consulting/resolve/main/src/workflow.py
- Command line
-
hf download hf://spaces/esturban/mgmt-consulting/src/workflow.py
-
curl -L -o workflow.py https://huggingface.co/spaces/esturban/mgmt-consulting/resolve/main/src/workflow.py
774 Bytes
| from langchain_core.messages import HumanMessage | |
| from langchain_openai import ChatOpenAI | |
| from .prompts import CONSULTANT_SYSTEM | |
| from .schema import CostOptimizationReport | |
| def run(operational_profile: str) -> CostOptimizationReport: | |
| """ | |
| Single-call cost optimization consultant: reads the operational profile, | |
| returns a CostOptimizationReport with recommendations ranked in a 2x2 matrix. | |
| Returns: | |
| CostOptimizationReport with quick_wins, major_projects, fill_ins, thankless_tasks | |
| """ | |
| llm = ChatOpenAI(model="gpt-4o-mini", temperature=0) | |
| consultant = CONSULTANT_SYSTEM | llm.with_structured_output(CostOptimizationReport) | |
| return consultant.invoke( | |
| HumanMessage(content="Operational profile:\n\n" + operational_profile) | |
| ) | |