[prompts] Add <environment_context> (#1869)

## Summary
Includes a new user message in the api payload which provides useful
environment context for the model, so it knows about things like the
current working directory and the sandbox.

## Testing
Updated unit tests
This commit is contained in:
Dylan
2025-08-06 01:13:31 -07:00
committed by GitHub
parent cda39e417f
commit 3e8bcf0247
8 changed files with 126 additions and 31 deletions

View File

@@ -41,11 +41,9 @@ pub(crate) async fn stream_chat_completions(
let full_instructions = prompt.get_full_instructions(model_family);
messages.push(json!({"role": "system", "content": full_instructions}));
if let Some(instr) = &prompt.get_formatted_user_instructions() {
messages.push(json!({"role": "user", "content": instr}));
}
let input = prompt.get_formatted_input();
for item in &prompt.input {
for item in &input {
match item {
ResponseItem::Message { role, content, .. } => {
let mut text = String::new();