Skip to content

Commit

Permalink
add documentation about file and template node
Browse files Browse the repository at this point in the history
  • Loading branch information
au-re committed Dec 11, 2023
1 parent c80bb24 commit 5b7ac51
Show file tree
Hide file tree
Showing 16 changed files with 107 additions and 47 deletions.
10 changes: 6 additions & 4 deletions websites/docs/.vitepress/config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,16 @@ export default defineConfig({
],
},
{
text: "Instructions",
text: "Nodes",
items: [
{ text: "Instruction", link: "/instructions/instruction" },
{ text: "Checklist", link: "/instructions/table" },
{ text: "File", link: "/nodes/file" },
{ text: "Template", link: "/nodes/template" },
{ text: "Instruction", link: "/nodes/instruction" },
{ text: "Checklist", link: "/nodes/table" },
],
},
{
text: "Building Tools",
text: "Guides",
items: [
{ text: "Introduction", link: "/tools/introduction" },
{ text: "Run your Tool", link: "/tools/run" },
Expand Down
2 changes: 1 addition & 1 deletion websites/docs/pages/concepts/file.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Files are how you keep track of text you want to pass to a Language Models. It is different from an instruction in that
it only contains data. This could be anything from a user question, a short story, a recipe or a research paper.

You can use your files to test your [instructions](instructions.md) or as part of a [tool](tools.md).
You can use your files to test your [instructions](instructions.md) or as part of a [tool](tools.md). To use your file as part of a tool, add the [file node](/data/file.md) to it.

::: warning Under Construction

Expand Down
4 changes: 2 additions & 2 deletions websites/docs/pages/concepts/instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ How prompts are presented to a language model makes a big difference regarding t

Below is a list of currently available instructions and when to use them.

- [Instruction](/instructions/instruction) : will provide your prompt to a language model without any transformation besides inserting variables. For prompts that exceed the context length of the target llm, the start and end of the prompt are preserved while the center is summarized.
- [Instruction](/nodes/instruction) : will provide your prompt to a language model without any transformation besides inserting variables. For prompts that exceed the context length of the target llm, the start and end of the prompt are preserved while the center is summarized.

- [Checklist](/instructions/table): will run your prompt sequentially over a document of variable length and fill a table with parameters you requested. The full document is provided to the LLM as is to ensure no information is missed. This Instruction type is ideal for analyzing documents, running checklists or extracting information from unstructured data.
- [Checklist](/nodes/table): will run your prompt sequentially over a document of variable length and fill a table with parameters you requested. The full document is provided to the LLM as is to ensure no information is missed. This Instruction type is ideal for analyzing documents, running checklists or extracting information from unstructured data.

## Instruction Playground

Expand Down
4 changes: 3 additions & 1 deletion websites/docs/pages/concepts/tools.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Tools

A tool is a series of [instructions](instructions.md) that can be combined to create more complex features. Once created, your tool can be deployed and becomes available through an API. You can use our SDK or our Rest API to integrate the workflow into your codebase. You can also share a preview of the tool using our [shareable ui](../tools/preview.md) feature.
Tools can automate tasks, process documents, classify data and do a lot more. We are constantly expanding the set of features available within the tool editor.

A tool is a series of `nodes` that can either be [instructions](instructions.md) or [data](file.md) and that can be combined together to create more complex features. Once created, your tool can be deployed through an API. You can use our [SDK](/sdk/js) or our [Rest API](/api/getting-started) to integrate the tool into your codebase. You can also share a preview of the tool using our [shareable ui](../tools/preview.md) feature.

::: warning Under Construction

Expand Down
25 changes: 0 additions & 25 deletions websites/docs/pages/instructions/table.md

This file was deleted.

17 changes: 17 additions & 0 deletions websites/docs/pages/nodes/file.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# File

The **file node** allows you to use files in a [tool](/concepts/tools). To upload a file simply click on "Select File" you will be able to upload a new file or select a previously uploaded file.

Supported formats are `.txt`, `.csv`, `.pdf`, `.md`.

![file](./images/file.png)

## Inputs

The file node has the following inputs:

**`Text`** content of the file, _ignore this if you just want to upload a file_

## Outputs

**`Text`** content of the file
Binary file added websites/docs/pages/nodes/images/file.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
Binary file added websites/docs/pages/nodes/images/template.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,15 @@ The default instruction will provide your prompt to a language model without any

The Instruction node has the following inputs:

- **Control**: if this field is not connected the instruction will not run.
- **AI Settings**: what [language model](/concepts/llms) and parameters to use to complete the instruction
- **Prompt**: The [prompt](/concepts/prompts) to provide to the language model
**`Control`** if this field is not connected the instruction will not run

**`AI Settings`** what [language model](/concepts/llms) and parameters to use to complete the instruction

**`Prompt`** The [prompt](/concepts/prompts) to provide to the language model

## Outputs

**`Results`** The resulting values generated by the LLM

## Adding variables

Expand Down
35 changes: 35 additions & 0 deletions websites/docs/pages/nodes/table.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Checklist

The **checklist instruction** will run your prompt sequentially over a document of any length and fill a table with parameters you requested. The full document is provided to the LLM as is, to ensure no information is missed. This is ideal for analyzing documents, running checklists or extracting information from unstructured data.

This node returns a table in either CSV or markdown formats, and will self heal incompatible results.

![Table](./images/table.png)

## Inputs

The Instruction node has the following inputs:

**`Control`** if this field is not connected the instruction will not run.

**`AI Settings`** what [language model](/concepts/llms) and parameters to use to complete the instruction

**`Instructions`** additional information to the LLM, that will be inserted at the start of the prompt

**`Document`** the document to process, if the document + prompt are larger than the context length of the model, the document will be split and the prompt run on each part of the document

**`Checks`** the categories you would like to check, each check is composed of a label and a description e.g. label: "is_contract" description: "is the document a contract"

**`Fields`** additional columns for the resulting table, e.g. add "reasoning" as a field if you would like to get feedback as to why the language model picked a value

**`Format`** the format to return the table in, this can be CSV or markdown

::: info Defining checks

When defining a check, make sure to be as descriptive as possible for the language model to be able to complete the table correctly

:::

## Outputs

**`Checklist`** A table containing the checks in the required format
23 changes: 23 additions & 0 deletions websites/docs/pages/nodes/template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Template

The **template node** allows you to join different inputs together. This can be helpful to create text that follows a specific format.

At first glance the template node looks a lot like the [file](/nodes/file) node. The main difference is that the template node can be given variables.

![template](./images/template.png)

Let's say you want to format some inputs in a table, you can use the template node to do that:

![template_format](./images/template_format.png)

## Inputs

The template node has the following inputs:

**`Template`** template to be completed

**`Any variable`** you add to the template will also become an input

## Outputs

**`Text`** template with values inserted
22 changes: 11 additions & 11 deletions websites/docs/pages/sdk/js.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ npm i @pufflig/ps-sdk
or yarn

```
npm yarn @pufflig/ps-sdk
yarn add @pufflig/ps-sdk
```

## Usage
Expand All @@ -35,7 +35,7 @@ const { datapoint } = await runInstruction({
console.log(datapoint.modelOutput); // As of 2021, the fastest car in the world is the Bugatti Chiron Super Sport 300+, with a top speed of 304 mph.
```

You can find your api key in prompt studio under the "API" tab of the tool editor. Each workspace in prompt studio will have its own key, this allows you to
Your API key is located in Prompt Studio, specifically under the "API" tab in the tool editor. Note that each workspace within Prompt Studio has a distinct key.

## Datapoints

Expand All @@ -54,13 +54,13 @@ Each model accepts different parameters.

## `runInstruction(RunInstructionInput)`

Generate a completion given a prompt. If the prompt is
Generate a completion given a prompt. If the prompt is larger than the context length permitted by the LLM the start and end of the prompt are preserved while the center is summarized.

Input

> | name | type | data type | description |
> | ---------- | -------- | ---------------------- | ----------------------------------------------- |
> | apiKey | required | string | Your prompt studio api key |
> | apiKey | required | string | Your Prompt Studio api key |
> | modelId | required | string | The model to call |
> | prompt | required | string | The prompt to provide to the language model |
> | parameters | optional | Record<string, string> | The parameters to provide to the language model |
Expand All @@ -74,14 +74,14 @@ Return
## `runWorkflow(RunWorkflowInput)`

Run a deployed workflow on prompt studio.
Run a deployed workflow on Prompt Studio.

Inputs

> | name | type | data type | description |
> | ------------ | -------- | ------------------- | -------------------------- |
> | apiKey | required | string | Your prompt studio api key |
> | deploymentId | required | string | Your prompt studio api key |
> | apiKey | required | string | Your Prompt Studio api key |
> | deploymentId | required | string | Your Prompt Studio api key |
> | input | required | Record<string, any> | Input to a workflow |
> | options | optional | [Options](#options) | Request options |
Expand All @@ -103,7 +103,7 @@ Return
## `Options`

> | name | type | data type | description |
> | ----- | -------- | --------- | -------------------------------------------------------------------------------- |
> | cache | optional | boolean | Return cached value, note some parameters like temperature will invalidate cache |
> | track | optional | boolean | Track the resulting datapoint |
> | name | type | data type | description |
> | ----- | -------- | --------- | ---------------------------------------------------------------------------------------- |
> | cache | optional | boolean | Return cached value if true, note some parameters like temperature will invalidate cache |
> | store | optional | boolean | If true, store the completion in Prompt Studio for later use, e.g. for fine-tuning |

0 comments on commit 5b7ac51

Please sign in to comment.