Skip to content

Clean categories

aiopenaichatgptgptclusters

Clean a given column of categories or lists of categories using OpenAI.

Usage


The following are the step's expected inputs and outputs and their specific types.

Step signature
clean_categories(original: category|list[category], {
    "param": value
}) -> (cleaned: column)

where the object {"param": value} is optional in most cases and if present may contain any of the parameters described in the corresponding section below.

Example

Get country for each address, as a category

Example call (in recipe editor)
clean_categories(ds.categories, {
    "integration": "open-ai-1",
    "instructions": "Generate around 10 categories.",
    "model": {
        "id": "gpt-4-0125-preview",
        "temperature": 0.7
    }
}) ->(ds.cleaned_categories)

Inputs


original: column:category|list[category]

original column.

Outputs


cleaned: column

cleaned column.

Parameters


integration: string

Associated integration.


categories: array[string]

Categories desired in the result column. If passed instructions are ignored.


instructions: string

Further instructions to generate the desired set of categories. You can ask for things like 'generate around 5 categories'.


model: object

Model Configuration. Configuration for OpenAI's model.

Items in model

id: string = "gpt-3.5-turbo-1106"

OpenAI model to choose.

Must be one of: "gpt-3.5-turbo-1106", "gpt-3.5-turbo", "gpt-4", "gpt-4-32k", "gpt-4-0125-preview", "gpt-4-1106-preview"


temperature: number = 0.7

Temperature. Higher means more creativity, but also makes the model more likely to hallucinate. Lower temperature yields more deterministic results.

Range: 0 ≤ temperature ≤ 1