-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathagents.ts
165 lines (125 loc) · 3.91 KB
/
agents.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from '../../resource';
import * as Core from '../../core';
import * as Shared from '../shared';
import * as SessionAPI from './session';
import {
Session,
SessionCreateParams,
SessionCreateResponse,
SessionResource,
SessionRetrieveParams,
} from './session';
import * as StepsAPI from './steps';
import { StepRetrieveResponse, Steps } from './steps';
import * as TurnAPI from './turn';
import {
AgentTurnResponseStreamChunk,
Turn,
TurnCreateParams,
TurnCreateParamsNonStreaming,
TurnCreateParamsStreaming,
TurnResource,
TurnResponseEvent,
TurnResponseEventPayload,
} from './turn';
export class Agents extends APIResource {
session: SessionAPI.SessionResource = new SessionAPI.SessionResource(this._client);
steps: StepsAPI.Steps = new StepsAPI.Steps(this._client);
turn: TurnAPI.TurnResource = new TurnAPI.TurnResource(this._client);
create(body: AgentCreateParams, options?: Core.RequestOptions): Core.APIPromise<AgentCreateResponse> {
return this._client.post('/v1/agents', { body, ...options });
}
delete(agentId: string, options?: Core.RequestOptions): Core.APIPromise<void> {
return this._client.delete(`/v1/agents/${agentId}`, {
...options,
headers: { Accept: '*/*', ...options?.headers },
});
}
}
export interface InferenceStep {
/**
* A message containing the model's (assistant) response in a chat conversation.
*/
model_response: Shared.CompletionMessage;
step_id: string;
step_type: 'inference';
turn_id: string;
completed_at?: string;
started_at?: string;
}
export interface MemoryRetrievalStep {
/**
* A image content item
*/
inserted_context: Shared.InterleavedContent;
step_id: string;
step_type: 'memory_retrieval';
turn_id: string;
vector_db_ids: string;
completed_at?: string;
started_at?: string;
}
export interface ShieldCallStep {
step_id: string;
step_type: 'shield_call';
turn_id: string;
completed_at?: string;
started_at?: string;
violation?: Shared.SafetyViolation;
}
export interface ToolExecutionStep {
step_id: string;
step_type: 'tool_execution';
tool_calls: Array<Shared.ToolCall>;
tool_responses: Array<ToolResponse>;
turn_id: string;
completed_at?: string;
started_at?: string;
}
export interface ToolResponse {
call_id: string;
/**
* A image content item
*/
content: Shared.InterleavedContent;
tool_name: 'brave_search' | 'wolfram_alpha' | 'photogen' | 'code_interpreter' | (string & {});
}
export interface AgentCreateResponse {
agent_id: string;
}
export interface AgentCreateParams {
agent_config: Shared.AgentConfig;
}
Agents.SessionResource = SessionResource;
Agents.Steps = Steps;
Agents.TurnResource = TurnResource;
export declare namespace Agents {
export {
type InferenceStep as InferenceStep,
type MemoryRetrievalStep as MemoryRetrievalStep,
type ShieldCallStep as ShieldCallStep,
type ToolExecutionStep as ToolExecutionStep,
type ToolResponse as ToolResponse,
type AgentCreateResponse as AgentCreateResponse,
type AgentCreateParams as AgentCreateParams,
};
export {
SessionResource as SessionResource,
type Session as Session,
type SessionCreateResponse as SessionCreateResponse,
type SessionCreateParams as SessionCreateParams,
type SessionRetrieveParams as SessionRetrieveParams,
};
export { Steps as Steps, type StepRetrieveResponse as StepRetrieveResponse };
export {
TurnResource as TurnResource,
type AgentTurnResponseStreamChunk as AgentTurnResponseStreamChunk,
type Turn as Turn,
type TurnResponseEvent as TurnResponseEvent,
type TurnResponseEventPayload as TurnResponseEventPayload,
type TurnCreateParams as TurnCreateParams,
type TurnCreateParamsNonStreaming as TurnCreateParamsNonStreaming,
type TurnCreateParamsStreaming as TurnCreateParamsStreaming,
};
}