1
1
# AiManager
2
2
3
- - [ Send AI question request ] ( #send-ai- question-request )
4
- - [ Send AI request to generate text] ( #send-ai-request-to- generate-text )
3
+ - [ Ask question] ( #ask- question )
4
+ - [ Generate text] ( #generate-text )
5
5
- [ Get AI agent default configuration] ( #get-ai-agent-default-configuration )
6
+ - [ Extract metadata (freeform)] ( #extract-metadata-freeform )
7
+ - [ Extract metadata (structured)] ( #extract-metadata-structured )
6
8
7
- ## Send AI question request
9
+ ## Ask question
8
10
9
11
Sends an AI request to supported LLMs and returns an answer specifically focused on the user's question given the provided context.
10
12
@@ -20,14 +22,14 @@ await client.ai.createAiAsk({
20
22
mode: ' multiple_item_qa' as AiAskModeField ,
21
23
prompt: ' Which direction sun rises?' ,
22
24
items: [
23
- new AiAskItemsField ({
25
+ new AiItemBase ({
24
26
id: fileToAsk1 .id ,
25
- type: ' file' as AiAskItemsTypeField ,
27
+ type: ' file' as AiItemBaseTypeField ,
26
28
content: ' Earth goes around the sun' ,
27
29
}),
28
- new AiAskItemsField ({
30
+ new AiItemBase ({
29
31
id: fileToAsk2 .id ,
30
- type: ' file' as AiAskItemsTypeField ,
32
+ type: ' file' as AiItemBaseTypeField ,
31
33
content: ' Sun rises in the East in the morning' ,
32
34
}),
33
35
],
@@ -47,9 +49,9 @@ This function returns a value of type `AiResponseFull`.
47
49
48
50
A successful response including the answer from the LLM.
49
51
50
- ## Send AI request to generate text
52
+ ## Generate text
51
53
52
- Sends an AI request to supported LLMs and returns an answer specifically focused on the creation of new text .
54
+ Sends an AI request to supported Large Language Models ( LLMs) and returns generated text based on the provided prompt .
53
55
54
56
This operation is performed by calling function ` createAiTextGen ` .
55
57
@@ -124,9 +126,72 @@ await client.ai.getAiAgentDefaultConfig({
124
126
125
127
### Returns
126
128
127
- This function returns a value of type ` AiAgentAskOrAiAgentTextGen ` .
129
+ This function returns a value of type ` AiAgentAskOrAiAgentExtractOrAiAgentExtractStructuredOrAiAgentTextGen ` .
128
130
129
131
A successful response including the default agent configuration.
130
- This response can be one of the following two objects:
131
- AI agent for questions and AI agent for text generation. The response
132
- depends on the agent configuration requested in this endpoint.
132
+ This response can be one of the following four objects:
133
+
134
+ - AI agent for questions
135
+ - AI agent for text generation
136
+ - AI agent for freeform metadata extraction
137
+ - AI agent for structured metadata extraction.
138
+ The response depends on the agent configuration requested in this endpoint.
139
+
140
+ ## Extract metadata (freeform)
141
+
142
+ Sends an AI request to supported Large Language Models (LLMs) and extracts metadata in form of key-value pairs.
143
+ Freeform metadata extraction does not require any metadata template setup before sending the request.
144
+
145
+ This operation is performed by calling function ` createAiExtract ` .
146
+
147
+ See the endpoint docs at
148
+ [ API Reference] ( https://developer.box.com/reference/post-ai-extract/ ) .
149
+
150
+ <!-- sample post_ai_extract -->
151
+
152
+ ``` ts
153
+ await client .ai .createAiExtract ({
154
+ prompt: ' firstName, lastName, location, yearOfBirth, company' ,
155
+ items: [new AiItemBase ({ id: file .id })],
156
+ } satisfies AiExtract );
157
+ ```
158
+
159
+ ### Arguments
160
+
161
+ - requestBody ` AiExtract `
162
+ - Request body of createAiExtract method
163
+ - optionalsInput ` CreateAiExtractOptionalsInput `
164
+ -
165
+
166
+ ### Returns
167
+
168
+ This function returns a value of type ` AiResponse ` .
169
+
170
+ A response including the answer from the LLM.
171
+
172
+ ## Extract metadata (structured)
173
+
174
+ Sends an AI request to supported Large Language Models (LLMs) and returns extracted metadata as a set of key-value pairs.
175
+ For this request, you need to use an already defined metadata template or a define a schema yourself.
176
+ To learn more about creating templates, see [ Creating metadata templates in the Admin Console] ( https://support.box.com/hc/en-us/articles/360044194033-Customizing-Metadata-Templates )
177
+ or use the [ metadata template API] ( g://metadata/templates/create ) .
178
+
179
+ This operation is performed by calling function ` createAiExtractStructured ` .
180
+
181
+ See the endpoint docs at
182
+ [ API Reference] ( https://developer.box.com/reference/post-ai-extract-structured/ ) .
183
+
184
+ _ Currently we don't have an example for calling ` createAiExtractStructured ` in integration tests_
185
+
186
+ ### Arguments
187
+
188
+ - requestBody ` AiExtractStructured `
189
+ - Request body of createAiExtractStructured method
190
+ - optionalsInput ` CreateAiExtractStructuredOptionalsInput `
191
+ -
192
+
193
+ ### Returns
194
+
195
+ This function returns a value of type ` AiExtractResponse ` .
196
+
197
+ A successful response including the answer from the LLM.
0 commit comments