The open-source agent harness - the runtime layer that turns an LLM into a working agent.
resolve conflicts (#1096)
Hary Ahuja5dd00891e0f8
diff --git a/.changeset/content-filter-error.md b/.changeset/content-filter-error.mdnew file mode 100644index 000000000..15d078417--- /dev/null+++ b/.changeset/content-filter-error.md@@ -0,0 +1,5 @@+---+'@truefoundry/trueforge-core': patch+---++Fail the turn with an explanatory error (`Output blocked: the model's content safety filter stopped the response. Rephrase the request and retry.`) when the content filter stops the response, instead of finishing with empty output.diff --git a/packages/trueforge-core/src/core/runtime/finishReasonError.ts b/packages/trueforge-core/src/core/runtime/finishReasonError.tsindex ffdfc81db..2cd6e6173 100644--- a/packages/trueforge-core/src/core/runtime/finishReasonError.ts+++ b/packages/trueforge-core/src/core/runtime/finishReasonError.ts@@ -23,6 +23,8 @@ export function finishReasonErrorMessage({const used = outputTokens > 0 && outputTokens !== maxOutputTokens ? ` after ${String(outputTokens)} tokens` : '';return `Output truncated: hit ${limit}${used}. Raise max_tokens and retry.`;}+ case 'content_filter':+ return "Output blocked: the model's content safety filter stopped the response. Rephrase the request and retry.";default:return undefined;}diff --git a/packages/trueforge-core/tests/core/runtime/finishReasonError.test.ts b/packages/trueforge-core/tests/core/runtime/finishReasonError.test.tsindex 7b263cfa9..eca2303c4 100644--- a/packages/trueforge-core/tests/core/runtime/finishReasonError.test.ts+++ b/packages/trueforge-core/tests/core/runtime/finishReasonError.test.ts@@ -91,6 +91,12 @@ describe('AgentThread finish reason errors', () => {modelParams: undefined,error: "Output truncated: hit the provider's default token limit after 4096 tokens. Raise max_tokens and retry.",},+ {+ name: 'content_filter',+ finishReason: 'content_filter',+ modelParams: undefined,+ error: "Output blocked: the model's content safety filter stopped the response. Rephrase the request and retry.",+ },])('fails the turn for $name', async ({ finishReason, modelParams, error }) => {const done = await runUntilDone({ finishReason, modelParams });expect(done).toMatchObject({ status: 'error', error });