1import type * as bedrock from "@distilled.cloud/aws/bedrock-agent";
2import type * as Effect from "effect/Effect";
3import * as Binding from "../../Binding.ts";
4import type { DataSource } from "./DataSource.ts";
5
6/**
7 * The `IngestKnowledgeBaseDocuments` request with the binding-injected
8 * `knowledgeBaseId` and `dataSourceId` removed — they are supplied
9 * automatically from the bound {@link DataSource}.
10 */
11export interface IngestKnowledgeBaseDocumentsRequest extends Omit<
12 bedrock.IngestKnowledgeBaseDocumentsRequest,
13 "knowledgeBaseId" | "dataSourceId"
14> {}
15
16/**
17 * Runtime binding for `bedrock-agent:IngestKnowledgeBaseDocuments` — ingest
18 * documents directly into the bound {@link DataSource}'s knowledge base
19 * (inline text or S3 references) without running a full ingestion job.
20 * The data source must be of type `CUSTOM` for inline content.
21 *
22 * The binding grants the function `bedrock:IngestKnowledgeBaseDocuments`
23 * scoped to the data source's parent knowledge base.
24 *
25 * ### Direct Document Ingestion
26 * **Example:** Ingest an Inline Text Document
27 * ```typescript
28 * // init
29 * const ingestDocuments =
30 * yield* Bedrock.IngestKnowledgeBaseDocuments(dataSource);
31 *
32 * // runtime
33 * const { documentDetails } = yield* ingestDocuments({
34 * documents: [
35 * {
36 * content: {
37 * dataSourceType: "CUSTOM",
38 * custom: {
39 * customDocumentIdentifier: { id: "welcome-doc" },
40 * sourceType: "IN_LINE",
41 * inlineContent: {
42 * type: "TEXT",
43 * textContent: { data: "Alchemy is an IaE framework." },
44 * },
45 * },
46 * },
47 * },
48 * ],
49 * });
50 * ```
51 *
52 * @binding
53 */
54export interface IngestKnowledgeBaseDocuments extends Binding.Service<
55 IngestKnowledgeBaseDocuments,
56 "AWS.Bedrock.IngestKnowledgeBaseDocuments",
57 <D extends DataSource>(
58 dataSource: D,
59 ) => Effect.Effect<
60 (
61 request: IngestKnowledgeBaseDocumentsRequest,
62 ) => Effect.Effect<
63 bedrock.IngestKnowledgeBaseDocumentsResponse,
64 bedrock.IngestKnowledgeBaseDocumentsError
65 >
66 >
67> {}
68export const IngestKnowledgeBaseDocuments =
69 Binding.Service<IngestKnowledgeBaseDocuments>(
70 "AWS.Bedrock.IngestKnowledgeBaseDocuments",
71 );