Constructor
new AskADocumentPipeline(name, kwargs)
Parameters:
Name | Type | Default | Description |
---|---|---|---|
name |
string | null | The name of this pipeline. Will be used to reference this pipeline if this pipeline is used as a Node inside another pipeline. |
kwargs |
Object | Include other needed properties like apiKey |
Methods
(async) call(user, doc_ids, question, execution_codeopt) → {Object}
Start the pipeline processes.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
user |
string | The ID of the user accessing the Soffos API. Soffos assumes that the owner of the api is an application (app) and that app has users. Soffos API will accept any string. | ||
doc_ids |
Array.<string> | the document IDs of included document. | ||
question |
string | The question about the document. | ||
execution_code |
string |
<optional> |
null | If this process should be tracked so it can be terminated via terminate() method, execution_code should be provided to reference this pipeline call. |
Returns:
{
search: { passages: "List of passages", },
qa: { answer: "The answer to the query." }
}
search: { passages: "List of passages", },
qa: { answer: "The answer to the query." }
}
- Type
- Object
Example
let pipe = new AskADocumentPipeline("my_pipeline", {apiKey: my_apiKey});
// On this test, the API key used must have access to document "1d77babf8164427cad8276ba944e6cbc"
// Please ingest a document first and replace the document_id here.
let result = await pipe.call("client_id", ["1d77babf8164427cad8276ba944e6cbc"], "Who is Neo?");
console.log(JSON.stringify(result, null, 2));