-
Notifications
You must be signed in to change notification settings - Fork 159
Expand file tree
/
Copy pathAiExtractStructured.cs
More file actions
74 lines (62 loc) · 2.76 KB
/
Copy pathAiExtractStructured.cs
File metadata and controls
74 lines (62 loc) · 2.76 KB
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
using Box.Sdk.Gen;
using System.Text.Json.Serialization;
using Box.Sdk.Gen.Internal;
using System.Collections.Generic;
using System;
using System.Collections.ObjectModel;
using Box.Sdk.Gen.Schemas;
namespace Box.Sdk.Gen.Schemas {
public class AiExtractStructured : ISerializable {
/// <summary>
/// The items to be processed by the LLM. Currently you can use files only.
/// </summary>
[JsonPropertyName("items")]
public IReadOnlyList<AiItemBase> Items { get; }
/// <summary>
/// The metadata template containing the fields to extract.
/// For your request to work, you must provide either `metadata_template` or `fields`, but not both.
/// </summary>
[JsonPropertyName("metadata_template")]
public AiExtractStructuredMetadataTemplateField? MetadataTemplate { get; init; }
/// <summary>
/// The fields to be extracted from the provided items.
/// For your request to work, you must provide either `metadata_template` or `fields`, but not both.
/// </summary>
[JsonPropertyName("fields")]
public IReadOnlyList<AiExtractStructuredFieldsField>? Fields { get; init; }
[JsonPropertyName("ai_agent")]
public AiExtractStructuredAgent? AiAgent { get; init; }
/// <summary>
/// A flag to indicate whether confidence scores for every extracted field should be returned.
/// </summary>
[JsonPropertyName("include_confidence_score")]
public bool? IncludeConfidenceScore { get; init; }
/// <summary>
/// A flag to indicate whether references for every extracted field should be returned.
/// </summary>
[JsonPropertyName("include_reference")]
public bool? IncludeReference { get; init; }
/// <summary>
/// The taxonomy sources to be used for the structured extraction. They can either be an existing file or a taxonomy.
/// For your request to work, `fields` must also be provided. `taxonomy_sources` is not supported with `metadata_template`.
/// </summary>
[JsonPropertyName("taxonomy_sources")]
public IReadOnlyList<AiTaxonomySource>? TaxonomySources { get; init; }
public AiExtractStructured(IReadOnlyList<AiItemBase> items) {
Items = items;
}
internal string? RawJson { get; set; } = default;
void ISerializable.SetJson(string json) {
RawJson = json;
}
string? ISerializable.GetJson() {
return RawJson;
}
/// <summary>
/// Returns raw json response returned from the API.
/// </summary>
public Dictionary<string, object?>? GetRawData() {
return SimpleJsonSerializer.GetAllFields(this);
}
}
}