Created
January 4, 2026 22:45
-
-
Save rhuffstedtler/dde68cd4dc0a0542cc8cf4e2bbd17a54 to your computer and use it in GitHub Desktop.
LLM prompt to retrieve ten year treasury yield from FRED and return it in a JSON object
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Task: Output the market yield on US treasury securities at 10-Year Constant Maturity. | |
| ##General Instructions## | |
| 1. Don't retrieve anything extra through web searches. Only retrieve exactly what I asked for. | |
| 2. Where I have curly braces in the prompt replace them with the referenced variable or the instruction inside the curly braces. | |
| 3. Do not include anything in the response other than the JSON object. If you think there is something I must know, include it in the human_notes field of the json. | |
| ##Steps## | |
| 1. Determine today's date | |
| 2. Set variables | |
| 1. "start_date": {Today's date minus 7 days in YYYY-MM-DD format} | |
| 2. "end_date": {Today's date in YYYY-MM-DD format} | |
| 3. "series": DGS10 | |
| 3. Construct the url | |
| 1. "url": https://fred.stlouisfed.org/graph/fredgraph.csv?id={series}&cosd={start_date}&coed={end_date} | |
| 4. Retrieve the CSV document from {url} | |
| 5. Parse the returned CSV. Each line has two fields, an observation_date and the value for the observation. | |
| 6. Find the most recent observation (the one with the highest date). It will likely be the last line of the file. We will call its observation date "obs_date" and its value "rate" | |
| If you have an error at any step, save the error. I will tell you where to output it in the JSON. Immediately stop execution | |
| ##Output## | |
| A json object. The text in curly braces in this section should be replaced by the variable name I used above or by following the instructions inside the curly braces | |
| The keys should be "run", "inputs", "outputs", "human_notes", and (if there are any) "errors". | |
| "run" should have the following children: | |
| "id": {The id of the run. Use epoch seconds for this} | |
| "date": {Todays date and time in ISO-8601 format} | |
| "model": {The OpenAI model that was used to process it} | |
| "inputs" should have the following children: | |
| "url": {url} | |
| "outputs" should have the following children: | |
| "obs_date": {obs_date} | |
| "rate": {rate} | |
| "human_notes" should have no children, only text that you think provides necessary context. Keep these to 300 characters or less. | |
| "errors" if present should have one child: | |
| "error_text": {your brief description of what went wrong. Keep this to 300 characters or less} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment