Available Operations

list

List the existing prompts

Example Usage

import { SyllableSDK } from "syllable-sdk";

const syllableSDK = new SyllableSDK({
  apiKeyHeader: process.env["SYLLABLESDK_API_KEY_HEADER"] ?? "",
});

async function run() {
  const result = await syllableSDK.prompts.list({});

  // Handle the result
  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { SyllableSDKCore } from "syllable-sdk/core.js";
import { promptsList } from "syllable-sdk/funcs/promptsList.js";

// Use `SyllableSDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const syllableSDK = new SyllableSDKCore({
  apiKeyHeader: process.env["SYLLABLESDK_API_KEY_HEADER"] ?? "",
});

async function run() {
  const res = await promptsList(syllableSDK, {});

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

  // Handle the result
  console.log(result);
}

run();

Parameters

ParameterTypeRequiredDescription
requestoperations.PromptsListRequestTRUEThe request object to use for the request.
optionsRequestOptionsFALSEUsed to set various options for making HTTP requests.
options.fetchOptionsRequestInitFALSEOptions that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retriesRetryConfigFALSEEnables retrying HTTP requests under certain failure conditions.

Response

Promise<components.ListResponsePrompt>

Errors

Error TypeStatus CodeContent Type
errors.HTTPValidationError422application/json
errors.SDKError4XX, 5XX*/*

create

Create a new prompt

Example Usage

import { SyllableSDK } from "syllable-sdk";

const syllableSDK = new SyllableSDK({
  apiKeyHeader: process.env["SYLLABLESDK_API_KEY_HEADER"] ?? "",
});

async function run() {
  const result = await syllableSDK.prompts.create({
    name: "<value>",
    type: "<value>",
    llmConfig: {
      provider: "azure_openai",
      model: "gpt-4o",
      version: "2024-05-13",
      apiVersion: "2024-06-01",
    },
  });

  // Handle the result
  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { SyllableSDKCore } from "syllable-sdk/core.js";
import { promptsCreate } from "syllable-sdk/funcs/promptsCreate.js";

// Use `SyllableSDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const syllableSDK = new SyllableSDKCore({
  apiKeyHeader: process.env["SYLLABLESDK_API_KEY_HEADER"] ?? "",
});

async function run() {
  const res = await promptsCreate(syllableSDK, {
    name: "<value>",
    type: "<value>",
    llmConfig: {
      provider: "azure_openai",
      model: "gpt-4o",
      version: "2024-05-13",
      apiVersion: "2024-06-01",
    },
  });

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

  // Handle the result
  console.log(result);
}

run();

Parameters

ParameterTypeRequiredDescription
requestcomponents.PromptCreateTRUEThe request object to use for the request.
optionsRequestOptionsFALSEUsed to set various options for making HTTP requests.
options.fetchOptionsRequestInitFALSEOptions that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retriesRetryConfigFALSEEnables retrying HTTP requests under certain failure conditions.

Response

Promise<components.Prompt>

Errors

Error TypeStatus CodeContent Type
errors.HTTPValidationError422application/json
errors.SDKError4XX, 5XX*/*

update

Update an existing prompt

Example Usage

import { SyllableSDK } from "syllable-sdk";

const syllableSDK = new SyllableSDK({
  apiKeyHeader: process.env["SYLLABLESDK_API_KEY_HEADER"] ?? "",
});

async function run() {
  const result = await syllableSDK.prompts.update({
    name: "<value>",
    type: "<value>",
    llmConfig: {
      provider: "openai",
      model: "gpt-4o",
      version: "2024-05-13",
      apiVersion: "2024-06-01",
    },
    id: 857478,
  });

  // Handle the result
  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { SyllableSDKCore } from "syllable-sdk/core.js";
import { promptsUpdate } from "syllable-sdk/funcs/promptsUpdate.js";

// Use `SyllableSDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const syllableSDK = new SyllableSDKCore({
  apiKeyHeader: process.env["SYLLABLESDK_API_KEY_HEADER"] ?? "",
});

async function run() {
  const res = await promptsUpdate(syllableSDK, {
    name: "<value>",
    type: "<value>",
    llmConfig: {
      provider: "openai",
      model: "gpt-4o",
      version: "2024-05-13",
      apiVersion: "2024-06-01",
    },
    id: 857478,
  });

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

  // Handle the result
  console.log(result);
}

run();

Parameters

ParameterTypeRequiredDescription
requestcomponents.PromptUpdateTRUEThe request object to use for the request.
optionsRequestOptionsFALSEUsed to set various options for making HTTP requests.
options.fetchOptionsRequestInitFALSEOptions that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retriesRetryConfigFALSEEnables retrying HTTP requests under certain failure conditions.

Response

Promise<components.Prompt>

Errors

Error TypeStatus CodeContent Type
errors.HTTPValidationError422application/json
errors.SDKError4XX, 5XX*/*

getById

Get a prompt by ID

Example Usage

import { SyllableSDK } from "syllable-sdk";

const syllableSDK = new SyllableSDK({
  apiKeyHeader: process.env["SYLLABLESDK_API_KEY_HEADER"] ?? "",
});

async function run() {
  const result = await syllableSDK.prompts.getById({
    promptId: 931598,
  });

  // Handle the result
  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { SyllableSDKCore } from "syllable-sdk/core.js";
import { promptsGetById } from "syllable-sdk/funcs/promptsGetById.js";

// Use `SyllableSDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const syllableSDK = new SyllableSDKCore({
  apiKeyHeader: process.env["SYLLABLESDK_API_KEY_HEADER"] ?? "",
});

async function run() {
  const res = await promptsGetById(syllableSDK, {
    promptId: 931598,
  });

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

  // Handle the result
  console.log(result);
}

run();

Parameters

ParameterTypeRequiredDescription
requestoperations.PromptsGetByIdRequestTRUEThe request object to use for the request.
optionsRequestOptionsFALSEUsed to set various options for making HTTP requests.
options.fetchOptionsRequestInitFALSEOptions that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retriesRetryConfigFALSEEnables retrying HTTP requests under certain failure conditions.

Response

Promise<components.Prompt>

Errors

Error TypeStatus CodeContent Type
errors.HTTPValidationError422application/json
errors.SDKError4XX, 5XX*/*

delete

Delete a prompt

Example Usage

import { SyllableSDK } from "syllable-sdk";

const syllableSDK = new SyllableSDK({
  apiKeyHeader: process.env["SYLLABLESDK_API_KEY_HEADER"] ?? "",
});

async function run() {
  const result = await syllableSDK.prompts.delete({
    promptId: 545907,
    reason: "<value>",
  });

  // Handle the result
  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { SyllableSDKCore } from "syllable-sdk/core.js";
import { promptsDelete } from "syllable-sdk/funcs/promptsDelete.js";

// Use `SyllableSDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const syllableSDK = new SyllableSDKCore({
  apiKeyHeader: process.env["SYLLABLESDK_API_KEY_HEADER"] ?? "",
});

async function run() {
  const res = await promptsDelete(syllableSDK, {
    promptId: 545907,
    reason: "<value>",
  });

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

  // Handle the result
  console.log(result);
}

run();

Parameters

ParameterTypeRequiredDescription
requestoperations.PromptsDeleteRequestTRUEThe request object to use for the request.
optionsRequestOptionsFALSEUsed to set various options for making HTTP requests.
options.fetchOptionsRequestInitFALSEOptions that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retriesRetryConfigFALSEEnables retrying HTTP requests under certain failure conditions.

Response

Promise<any>

Errors

Error TypeStatus CodeContent Type
errors.HTTPValidationError422application/json
errors.SDKError4XX, 5XX*/*

promptsHistory

Get a prompt by ID

Example Usage

import { SyllableSDK } from "syllable-sdk";

const syllableSDK = new SyllableSDK({
  apiKeyHeader: process.env["SYLLABLESDK_API_KEY_HEADER"] ?? "",
});

async function run() {
  const result = await syllableSDK.prompts.promptsHistory({
    promptId: 627932,
  });

  // Handle the result
  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { SyllableSDKCore } from "syllable-sdk/core.js";
import { promptsPromptsHistory } from "syllable-sdk/funcs/promptsPromptsHistory.js";

// Use `SyllableSDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const syllableSDK = new SyllableSDKCore({
  apiKeyHeader: process.env["SYLLABLESDK_API_KEY_HEADER"] ?? "",
});

async function run() {
  const res = await promptsPromptsHistory(syllableSDK, {
    promptId: 627932,
  });

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

  // Handle the result
  console.log(result);
}

run();

Parameters

ParameterTypeRequiredDescription
requestoperations.PromptsHistoryRequestTRUEThe request object to use for the request.
optionsRequestOptionsFALSEUsed to set various options for making HTTP requests.
options.fetchOptionsRequestInitFALSEOptions that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retriesRetryConfigFALSEEnables retrying HTTP requests under certain failure conditions.

Response

Promise<components.PromptHistory[]>

Errors

Error TypeStatus CodeContent Type
errors.HTTPValidationError422application/json
errors.SDKError4XX, 5XX*/*