You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Refactor file reading functionality by consolidating read_markdown and read_csv_preview into a new read_file function that supports multiple file types. Update relevant prompts and agent configurations to utilize the new function. Enhance notebook output to include execution tracing information for better debugging and analysis context.
"\"Is walmart losing market share to instacart? Provide analysis as this will influence a trading decision.\"\n",
179
+
"\"How would the planned interest rate reduction effect my holdings in GOOGL if they were to happen?\"\n",
180
+
"\"Considering all the factors effecting its price right now (Macro, Technical, Fundamental, etc.), what is a realistic price target by the end of the year?\"\n",
Copy file name to clipboardExpand all lines: examples/agents_sdk/multi-agent-portfolio-collaboration/prompts/code_interpreter.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,9 +11,9 @@ You are an expert quantitative developer using OpenAI's Code Interpreter. You ar
11
11
## Analysis Workflow
12
12
1. Print the schema of each input file. Understand the dataset, and make logical assumptions on analysis even if the quant doesn't explicitly provide them.
13
13
2. Drop missing values and normalize data as needed.
14
-
3. Run the Analysis processed data, and inspect the data to ensure it ran.
15
-
4.Create visualizations that best fit the analysis type.
16
-
5. If the analysis cannot be completed even after the data processing, do not generate outputs. Instead, return a `<reason>` tag with a clear explanation, including the available columns.
14
+
3. Run the analysis on the processed data.
15
+
4.**If the data is empty or contains no rows after cleaning, do not generate any outputs. Instead, return only a `<reason>` tag explaining that the data is empty or insufficient for analysis, and list the available columns.**
16
+
5. If the data is sufficient, create visualizations and tables as appropriate for the analysis.
17
17
18
18
## Constraints
19
19
- Do **not** fetch external data or use `yfinance`. Use only the files in `input_files`.
Copy file name to clipboardExpand all lines: examples/agents_sdk/multi-agent-portfolio-collaboration/prompts/editor_base.md
+3-5Lines changed: 3 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -80,7 +80,7 @@ You will receive a structured dictionary with the following keys:
80
80
4.**Format**
81
81
- Embed files appropriately:
82
82
- Use `list_output_files` to discover available files.
83
-
- Use `read_csv_preview` for `.csv` files (preview the first ~10 rows as a markdown-friendly table before embedding as a Markdown table into the report).
83
+
- Use `read_file` for `.csv` files (preview the first ~10 rows as a markdown-friendly table before embedding as a Markdown table into the report).
84
84
- Use standard Markdown syntax for charts and images (only if the file exists), e.g., ``.
85
85
- You cannot read PNG files directly.
86
86
- These must be written to the report so they render. Do not just say "refer to image/chart or table" without rendering it in valid markdown.
@@ -101,8 +101,6 @@ You will receive a structured dictionary with the following keys:
101
101
**Example of a process (yours might be different):**
102
102
103
103
1. Use `list_output_files` to get available files.
104
-
2. Preview CSV files with `read_csv_preview` for `.csv` files.
104
+
2. Preview CSV files with `read_file` for `.csv` files.
105
105
3. Save the memo using `write_markdown` to generate the investment_report, add relevant charts and tables rendered in markdown.
106
-
4. Verify the memo using the `read_markdown` tool.
107
-
5. Return `{ "file": "investment_report.md" }` JSON to the PM Agent (not the memo, just the file).
108
-
106
+
4. Return `{ "file": "investment_report.md" }` JSON to the PM Agent (not the memo, just the file).
Copy file name to clipboardExpand all lines: examples/agents_sdk/multi-agent-portfolio-collaboration/prompts/quant_base.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -34,7 +34,7 @@ If you mention a file in your request but do not include it in `input_files`, th
34
34
---
35
35
36
36
**Additional Tools Available:**
37
-
-**read_csv_preview**: Use this tool to preview the contents of any CSVfile in the outputs directory before running an analysis. This helps you understand the schema, columns, and data quality, it doesn't generate any files.
37
+
-**read_file**: Use this tool to preview the contents of any CSV, Markdown, or text file in the outputs directory before running an analysis. For CSVs, it returns a markdown table preview. This helps you understand the schema, columns, and data quality, it doesn't generate any files.
38
38
-**list_output_files**: Use this tool to list all available files in the outputs directory. This helps you check which files are present and avoid referencing non-existent files. If you get file not found errors use this.
39
39
40
40
_You may use these tools to inspect available data and plan your analysis more effectively before calling run_code_interpreter._
Read and preview the contents of a file from the outputs directory.
166
162
167
-
# Determine if an explicit, non-Markdown extension was provided
168
-
suffix=Path(filename).suffix
169
-
ifsuffixandsuffix.lower() !=".md":
170
-
returnjson.dumps({
171
-
"error": f"Wrong extension. cannot read '{suffix}' files; only .md files are supported",
172
-
"file": filename,
173
-
})
163
+
Supports reading CSV, Markdown (.md), and plain text (.txt) files. For CSV files, returns a preview of the last `n_rows` as a Markdown table. For Markdown and text files, returns the full text content. For unsupported file types, returns an error message.
174
164
175
-
# If no extension or already .md, ensure filename ends with .md
176
-
ifnotfilename.endswith(".md"):
177
-
filename+=".md"
165
+
Args:
166
+
filename: The name of the file to read, relative to the outputs directory. Supported extensions: .csv, .md, .txt.
167
+
n_rows: The number of rows to preview for CSV files (default: 10).
178
168
169
+
Returns:
170
+
str: A JSON string containing either:
171
+
- For CSV: {"file": filename, "preview_markdown": "<markdown table>"}
172
+
- For Markdown/Text: {"file": filename, "content": "<text content>"}
173
+
- For errors: {"error": "<error message>", "file": filename}
174
+
"""
179
175
path=output_file(filename, make_parents=False)
180
176
ifnotpath.exists():
181
177
returnjson.dumps({"error": "file not found", "file": filename})
0 commit comments