Attachments.with_prompt()
Add a text prompt to accompany the file attachments.
Usage
Attachments.with_prompt(prompt)This method enables the fluent interface for combining prompt text with file attachments, following Talk Box’s chainable API design. The prompt provides context and instructions for how the AI should analyze or interact with the attached files.
Parameters
prompt The text prompt to include with the file attachments. This should provide clear instructions about what you want the AI to do with the attached files.
Returns
Attachments Returns self for method chaining.
Examples
Specific Analysis Request
import talk_box as tb
files = (
tb.Attachments("financial_report.pdf")
.with_prompt(
"Extract the key financial metrics and identify any concerning trends "
"in this quarterly report. Focus on revenue, profit margins, and cash flow."
)
)Code Review with Specific Criteria
code_review = tb.Attachments("src/main.py", "tests/test_main.py").with_prompt(
"Review this Python code for:
"
"1. Code quality and best practices
"
"2. Potential bugs or security issues
"
"3. Test coverage and completeness
"
"4. Performance optimization opportunities"
)Creative Content Generation
references = (
tb.Attachments("brand_guide.pdf", "competitor_analysis.md")
.with_prompt(
"Based on our brand guidelines and competitor analysis, create a "
"marketing strategy for our new product launch. Focus on differentiation "
"and brand consistency."
)
)Data Analysis with Context
data_files = (
tb.Attachments("sales_data.csv", "market_context.md")
.with_prompt(
"Analyze the sales data in the context of the market information provided. "
"Identify trends, anomalies, and actionable insights for the sales team."
)
)Multi-file Comparison
comparison = (
tb.Attachments("version1.py", "version2.py")
.with_prompt(
"Compare these two versions of the code and explain:
"
"- What changed between versions
"
"- Whether the changes improve or degrade the code
"
"- Any potential issues introduced"
)
)Notes
- the prompt is combined with file content when sent to the AI model
- clear, specific prompts lead to better analysis results
- you can include formatting instructions (bullets, sections, etc.)
- the prompt applies to all attached files collectively