Skip to content

Commit 7755366

Browse files
committed
fix financial prompt optimizer
1 parent 2fd1619 commit 7755366

2 files changed

Lines changed: 10 additions & 6 deletions

File tree

financial-prompt-optimizer/financial_prompt_optimizer/README.md renamed to financial-prompt-optimizer/README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ poetry install --no-root
3434

3535
``` sh
3636
cd financial-prompt-optimizer
37-
poetry run uvicorn financial_prompt_optimizer.main:app --port 7777 --reload
37+
poetry run uvicorn main:app --port 7777 --reload
3838
```
3939

4040
This command runs the FastAPI application, making it accessible on your network.
@@ -57,4 +57,6 @@ the API by visiting: http://localhost:7777/docs
5757
When you send a user message, the agent streams a single answer containing two
5858
sections:
5959

60-
- `Optimized Prompt: <improved prompt>`
60+
- `Optimized Prompt: <single improved prompt>`
61+
- `Rationale: <1–3 short bullets on what changed and why>`
62+

financial-prompt-optimizer/financial_prompt_optimizer/main.py renamed to financial-prompt-optimizer/main.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
ChatCompletionSystemMessageParam,
1717
)
1818

19+
1920
app = FastAPI()
2021

2122
app.add_middleware(
@@ -46,18 +47,19 @@ def get_copilot_description():
4647
}
4748
)
4849

50+
4951
@app.post("/v1/query")
5052
async def query(request: QueryRequest) -> EventSourceResponse:
51-
"""Query the Copilot."""
53+
"""Stream a concise optimized prompt and rationale."""
5254

5355
openai_messages: list[ChatCompletionMessageParam] = [
5456
ChatCompletionSystemMessageParam(
5557
role="system",
5658
content=(
5759
"You are a concise Financial Prompt Optimizer.\n"
5860
"Rewrite the user's prompt to be clearer, more specific, and immediately actionable for financial analysis.\n"
59-
"Always return it as:\n"
60-
"Optimized Prompt: <extensive detailed improved prompt with step-by-step>\n"
61+
"Always return exactly the improved prompt:\n"
62+
"Optimized Prompt: <detailed improved prompt with step-by-step>\n"
6163
),
6264
)
6365
]
@@ -91,4 +93,4 @@ async def execution_loop() -> AsyncGenerator[MessageChunkSSE, None]:
9193
if __name__ == "__main__":
9294
import uvicorn
9395

94-
uvicorn.run("financial_prompt_optimizer.main:app", host="0.0.0.0", port=7777, reload=True)
96+
uvicorn.run("main:app", host="0.0.0.0", port=7777, reload=True)

0 commit comments

Comments
 (0)