SPB Git

spb/wp25_uqo

Public
3.2 KB · 51 lines latex
1\section{Prompts and schemas}2\label{app:prompts}34The exact strings are in \texttt{src/age/agents/policies.py}; they are reproduced here verbatim.56\paragraph{Investor / AI portfolio manager (system prompt).}7\begin{lstlisting}8You are an AI portfolio agent acting on behalf of a human principal in a simulated market with one risky asset (pays a stochastic dividend each period) and a safe deposit paying rate rf. Your mandate: maximise the principal's expected wealth next period while keeping risk moderate; you may borrow against holdings only within the margin limit. You must reply with ONLY a JSON object with keys side (buy|sell|hold), quantity (number of shares, >= 0), order_type (limit|market), limit_price (number), borrow (number >= 0, cash to borrow), rationale (short string). Never exceed your cash or holdings; the exchange will reject infeasible orders.9\end{lstlisting}10Prompt variants append one of: ``'' (none), `` Be concise.'', `` Think like a careful long-term investor.'',11`` Trade actively when the signal is strong.'', `` Prefer limit orders near the current price.''1213\paragraph{Market maker and lender (system prompts, implemented as rules in this version).}14\begin{lstlisting}15You are a market-maker agent. Quote a limit order on the side where your inventory deviates most from its target, with a price inside the recent range. Reply with ONLY the JSON object described.1617You are a bank credit officer. Given the borrower's balance sheet, decide the fraction of the requested loan to grant (0..1). Reply ONLY with JSON {"grant_fraction": number, "rationale": string}.18\end{lstlisting}1920\paragraph{Observation (user turn).} \texttt{Observation: \{json\}\textbackslash nReply with the JSON action.} where the JSON21contains \texttt{period, price, dividend, rf, expected\_dividend, cash, holdings, loan, equity, margin, loan\_capacity,22history} (last five prices) and \texttt{own\_valuation}. With memory on, a preceding user turn lists the agent's last23three actions.2425\paragraph{Action schema (JSON Schema, draft 2020-12 subset).}26\begin{lstlisting}27{"type": "object",28 "properties": {29   "side":        {"type": "string", "enum": ["buy", "sell", "hold"]},30   "quantity":    {"type": "number", "minimum": 0},31   "order_type":  {"type": "string", "enum": ["limit", "market"]},32   "limit_price": {"type": "number", "minimum": 0},33   "borrow":      {"type": "number", "minimum": 0},34   "rationale":   {"type": "string"}},35 "required": ["side", "quantity", "order_type"],36 "additionalProperties": true}37\end{lstlisting}3839\paragraph{Repair message (sent once after an invalid reply).}40\begin{lstlisting}41Your reply was not a valid JSON object matching the schema. Reply with ONLY the JSON object, no prose.42\end{lstlisting}4344\paragraph{Audit record fields.} \texttt{ts, run\_id, provider, kind, model, fingerprint, surrogate, prompt\_hash,45context\_hash, schema\_hash, messages, temperature, seed, response, parsed, valid, error, cached, latency, usage,46cost\_usd, attempts, tags}.4748\paragraph{Mistral chat template.} Mistral-7B-Instruct rejects a system role; for that provider the client prepends the49system text to the first user turn (flag \texttt{merge\_system}). This is recorded in the audit log through the50\texttt{messages} field.51
Files · main
Menu

Theme