@rodrigobeber/patoai-dtos 4.8.19 → 4.8.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -2,11 +2,25 @@ import { AIFunctionCallItem, AIFunctionCallOutput, AITextConfig, AITool } from "
|
|
|
2
2
|
import { InputMessageDto } from "./input-message.dto";
|
|
3
3
|
import { ProviderDto } from "../core/provider.dto";
|
|
4
4
|
export type AIConversationTurn = AIFunctionCallItem | AIFunctionCallOutput;
|
|
5
|
+
/**
|
|
6
|
+
* Pedaco do prompt de sistema com controle proprio de cache (Anthropic; achatado em string unica pelos
|
|
7
|
+
* demais providers). Existe porque `instructions` e UM bloco so: com estavel e volatil no mesmo texto,
|
|
8
|
+
* qualquer parte que mude por pergunta reescreve o prefixo inteiro e nada do prompt cacheia.
|
|
9
|
+
* A ORDEM do array e a ordem no prompt — estavel primeiro, volatil depois.
|
|
10
|
+
*/
|
|
11
|
+
export interface AIInstructionBlock {
|
|
12
|
+
text: string;
|
|
13
|
+
cacheable?: boolean;
|
|
14
|
+
}
|
|
15
|
+
/** 1h custa 2x na escrita (contra 1,25x de 5m) — so compensa em prefixo global/de trafego esparso. */
|
|
16
|
+
export type AICacheTtl = '5m' | '1h';
|
|
5
17
|
export interface ResponseCreateDto {
|
|
6
18
|
provider: ProviderDto;
|
|
7
19
|
model: string;
|
|
8
20
|
background: boolean;
|
|
9
21
|
instructions: string;
|
|
22
|
+
/** Vence `instructions` quando presente (que segue como caminho unico dos demais consumidores). */
|
|
23
|
+
instructionBlocks?: AIInstructionBlock[];
|
|
10
24
|
messages: InputMessageDto[];
|
|
11
25
|
toolOutputs: AIFunctionCallOutput[];
|
|
12
26
|
turns?: AIConversationTurn[];
|
|
@@ -18,6 +32,13 @@ export interface ResponseCreateDto {
|
|
|
18
32
|
tools: AITool[];
|
|
19
33
|
userId: string;
|
|
20
34
|
cacheKey?: string;
|
|
35
|
+
/**
|
|
36
|
+
* Fecha um breakpoint no FIM das mensagens (depois dos `turns`), avancando a cada ida do tool loop.
|
|
37
|
+
* Sem ele, historico + bloco volatil + turns anteriores sao reenviados a 1x em TODA ida — o custo
|
|
38
|
+
* de um agente com ferramentas e dominado por essa reemissao, nao pelo prefixo.
|
|
39
|
+
*/
|
|
40
|
+
cacheTurns?: boolean;
|
|
41
|
+
cacheTtl?: AICacheTtl;
|
|
21
42
|
previousResponseId?: string;
|
|
22
43
|
includeFileSearchResults?: boolean;
|
|
23
44
|
skipSanitize?: boolean;
|