一键导入
file-store
Using FileStore to wrap files (images, PDFs, data) for use in EDSL survey scenarios.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Using FileStore to wrap files (images, PDFs, data) for use in EDSL survey scenarios.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Patterns for creating EDSL AgentLists from various sources: lists, CSV, Excel, DataFrame, and programmatic combinations.
Saving EDSL objects locally and publishing them to Coop (Expected Parrot's servers).
Templates for the standard EDSL study files: survey, scenarios, agents, models, and create_results.py.
Error logging protocol using append-only JSONL format (errors.jsonl).
Developer tool: find the most recent errors.jsonl from an agent run, diagnose root causes, and interactively patch the agent's instruction files to prevent recurrence.
Launching EDSL surveys for real human respondents via humanize, including scenario methods, Prolific integration, and retrieving responses.
| name | file-store |
| description | Using FileStore to wrap files (images, PDFs, data) for use in EDSL survey scenarios. |
Use FileStore(path=...) to wrap any file for use in surveys:
from edsl import FileStore
fs = FileStore(path="photo.png")
This works with many file types: images (png, jpeg, svg), documents (pdf, docx, pptx), data (csv, xlsx, json), text (txt, md, html), code (py, sql), databases (db/sqlite), video (mp4, webm), and LaTeX.
Pass a FileStore as a scenario value, then reference it in question text with Jinja2 templating:
from edsl import FileStore, Scenario, QuestionFreeText, Survey
fs = FileStore(path="chart.png")
scenario = Scenario({"file_path": fs})
q = QuestionFreeText(
question_name="describe",
question_text="What is in this image: {{ scenario.file_path }}?"
)
survey = Survey([q])
results = survey.by(scenario).run()
The {{ scenario.file_path }} placeholder is replaced with the file content at runtime, so the model sees the actual image/document.
Process many files by creating a scenario for each:
from edsl import FileStore, Scenario, ScenarioList
filenames = ["doc1.pdf", "doc2.pdf", "doc3.pdf"]
scenarios = ScenarioList([
Scenario({"file_path": FileStore(path=f)}) for f in filenames
])
results = survey.by(scenarios).run()
Scenarios can contain both files and regular data:
scenario = Scenario({
"file_path": FileStore(path="resume.pdf"),
"job_title": "Software Engineer"
})
q = QuestionFreeText(
question_name="evaluate",
question_text="Review this resume: {{ scenario.file_path }}. How well does the candidate fit the role of {{ job_title }}?"
)
| Task | Code |
|---|---|
| Create from file | FileStore(path="file.png") |
| Wrap in scenario | Scenario({"file_path": fs}) |
| Reference in question | {{ scenario.file_path }} |
| Multiple files | ScenarioList([Scenario({"file_path": FileStore(path=f)}) for f in files]) |
| Extract text | fs.extract_text() |
| CSV to scenarios | FileStore(path="data.csv").to_scenario_list() |
| Get MIME type | fs.mime_type |
| Check if image | fs.is_image() |