Haystack connector
Overview#
The Haystack connector reads asset data from a Haystack server. Haystack is an open-source AI framework for building AI agents and Retrieval-Augmented Generation (RAG) applications.
Note: For more information about Haystack refer to Haystack documentation.
How to use the Haystack connector#
To use the Haystack connector, pass an object with the parameters you require, from the schema table listed below. Also refer to the various code samples listed below.
Haystack Connector schema#
| Property | Type | Description | Required |
|---|---|---|---|
_orchcomp | String | Enter “J2_connector”. | Required |
_name | String | Enter a descriptive name for what the component does in the orchestrator. | Optional |
_sequenceno | Integer | Enter a number that defines the task’s order in the sequence of tasks to execute. | Required |
_actualparams | Object | Pass an object that contains formal parameters or alternative parameters you want to add as key-value pairs, such as “userType”: “<your-user-type>”. | Optional |
_actualparams.action | String | Enter one of the following SQL statements: readall, readbyid, readhistory, eval, config. | Required |
_actualparams.project | String | Takes the project name as a string. | Required |
_actualparams.url | String | Takes a datasource URL as a string. | Required |
_actualparams.uname | String | Takes the database username as a string. | Required |
_actualparams.pwd | String | Takes the database password as a string. | Required |
_actualparams.cmd | Object | Pass a command. | Optional |
_actualparams.to | String | To save the request response to File Service, enter "file" as the value. | Optional |
_actualparams.fileName | String | Enter the file name including the file extension. | Optional |
Generic code example#
Refer to the sample code below, with a generic SQL action type.
… { "_orchcomp": "J2_connector", "_name": "Haystack Connector", "_sequenceno": 1, "_actualparams": { "action": "readall" | "readybid" | "readhistory" | "eval" | "config" , "project": "project_name", "url": "<URL-to-your-database>", "uname": "johnDoe", "pwd": "secret", "cmd": "", "to": "file", "fileName": "haystack-connector-responses.json" } }, …Code examples for each SQL action type#
To use a Haystack connector with a specific SQL action type, refer to the code examples below.
Action type: readall#
"_actualparams": { "params": { "action":"readall", "cmd":"point and equipRef == @mechericenter", "project": "project_name", "url": "<URL-to-your-database>", "uname": "<username>", "pwd": "<password>" }}Action type: readbyid#
"_actualparams": { "params": { "action":"readybid", "id": "p:mechericenter:r:2660ba41-851d6a87" "project": "project_name", "url": "<URL-to-your-database>", "uname": "<username>", "pwd": "<password>" }}
Action type: readhistory#
"_actualparams": { "params": { "action":"readhistory", "id": "p:mechericenter:r:2660ba41-851d6a87", "range":"today", "project": "project_name", "url": "<URL-to-your-database>", "uname": "<username>", "pwd": "<password>" }}Action type: config#
"_actualparams": { "params": { "action": "config" "project": "project_name", "url": "<URL-to-your-database>", "uname": "<username>", "pwd": "<password>" }}Action type: eval#
"_actualparams": { "params": { "action":"eval", "cmd": "readAll(point).hisRead(date(2024,08,02)..now()).hisClip()", "project": "project_name", "url": "<URL-to-your-database>", "uname": "<username>", "pwd": "<password>" }}