Function: psi()
@kortexya/reasoninglayer / psi
Function: psi()
Section titled “Function: psi()”Call Signature
Section titled “Call Signature”psi(
sortName,features?):PsiTermInputByName
Defined in: src/builders/psi.ts:61
Create a format-agnostic psi-term identified by sort name.
Parameters
Section titled “Parameters”sortName
Section titled “sortName”string
The sort name (resolved server-side).
features?
Section titled “features?”Record<string, unknown>
Optional features map using plain JavaScript values.
Returns
Section titled “Returns”A PsiTermInput that can be used with both term CRUD and inference methods.
Remarks
Section titled “Remarks”The psi() builder stores plain values as-is. Conversion to the correct wire
format (tagged ValueDto or untagged TermInputDto) happens automatically
when you pass the result to a resource client method.
Special string prefixes (only meaningful in inference context):
"?X"(?+ uppercase letter) — auto-detected as a variable"!uuid"(!prefix) — auto-detected as a term reference (strips!)
null means uninstantiated — maps to {"type":"Uninstantiated"} in tagged
format or JSON null in untagged format, depending on which endpoint receives it.
Example
Section titled “Example”import { psi, constrained, guard } from '@kortexya/reasoninglayer';
// Simple term:const alice = psi("person", { name: "Alice", age: 30 });
// With variable (auto-detected "?" prefix):const query = psi("person", { name: "?Name", age: "?Age" });
// Nested psi-terms:const company = psi("company", { name: "Acme", ceo: psi("person", { name: "Bob" }),});
// Uninstantiated values:const partial = psi("employee", { name: "Alice", salary: null });
// Term reference (auto-detected "!" prefix):const withRef = psi("department", { manager: "!550e8400-..." });Call Signature
Section titled “Call Signature”psi(
sort,features?):PsiTermInputById
Defined in: src/builders/psi.ts:87
Create a format-agnostic psi-term identified by sort ID.
Parameters
Section titled “Parameters”Object with sortId (UUID).
sortId
Section titled “sortId”string
features?
Section titled “features?”Record<string, unknown>
Optional features map using plain JavaScript values.
Returns
Section titled “Returns”A PsiTermInput that can be used with both term CRUD and inference methods.
Remarks
Section titled “Remarks”Use this overload when you have a sort ID from a runtime lookup (e.g., listSorts()
after LLM-based ingestion) and don’t have the sort name.
Example
Section titled “Example”import { psi } from '@kortexya/reasoninglayer';
// By sort ID:const term = psi({ sortId: "550e8400-e29b-41d4-a716-446655440000" }, { name: "Alice" });
// From a runtime lookup:const sorts = await client.sorts.listSorts();const personSort = sorts.items.find(s => s.name === "person");const query = psi({ sortId: personSort.sortId }, { name: "?Name" });