Class: Nolita

High level wrapper for the Nolita API.

Constructors

new Nolita()

new Nolita(hdrApiKey: string, providerApiKey: string, opts?: {endpoint: string;model: string;provider: string;systemPrompt: string;temperature: number; }): Nolita

Initializes a new instance of the Nolita class.

Parameters

ParameterTypeDescription
hdrApiKeystringThe HDR api key.
providerApiKeystringThe collective memory endpoint. Defaults to "https://api.hdr.is".
opts?objectOptional configuration options
opts.endpoint?stringThe collective memory endpoint. Defaults to "https://api.hdr.is".
opts.model?stringThe model to use. Defaults to "gpt-4".
opts.provider?stringThe provider to use. Defaults to "openai".
opts.systemPrompt?stringThe system prompt to use.
opts.temperature?numberThe temperature to use. Defaults to 0

Returns

Nolita

Defined in

src/nolita.ts:34

Properties

agent

agent: Agent

The agent instance that interacts with the browser. Defaults to OpenAI's gpt-4

Defined in

src/nolita.ts:21


hdrApiKey

hdrApiKey: string

The HDR api key.

Defined in

src/nolita.ts:18


hdrEndpoint

hdrEndpoint: string = "https://api.hdr.is"

The collective memory endpoint. Defaults to "https://api.hdr.is".

Defined in

src/nolita.ts:19

Methods

task()

task(task: {objective: string;returnSchema: ZodObject<any, UnknownKeysParam, ZodTypeAny, {}, {}>;startUrl: string; }, opts?: {headless: boolean;inventory: Inventory;maxTurns: number; }): Promise<{command: ({index: number;kind: "Click"; } | {index: number;kind: "Type";text: string; } | {kind: "Back"; } | {kind: "Wait"; })[];description: string;objectiveComplete: updatedObjectiveComplete;progressAssessment: string; } | {objectiveFailed: {kind: "ObjectiveFailed";result: failureReason;url: string; }; }>

Executes a task using the Nolita API.

Parameters

ParameterTypeDescription
taskobjectstring "Tell me the email addresses on the contact page"
task.objectivestringstring The objective of the task "Tell me the email addresses on the contact page"
task.returnSchema?ZodObject<any, UnknownKeysParam, ZodTypeAny, {}, {}>z.ZodObject The schema to return
task.startUrl?stringstring The URL the taks will begin at "https://hdr.is"
opts?object
opts.headless?booleanboolean Whether to run the browser in headless mode. Defaults to false
opts.inventory?InventoryInventory The inventory to use when doing tasks
opts.maxTurns?numbernumber The maximum number of turns to allow. Defaults to 10

Returns

Promise<{command: ({index: number;kind: "Click"; } | {index: number;kind: "Type";text: string; } | {kind: "Back"; } | {kind: "Wait"; })[];description: string;objectiveComplete: updatedObjectiveComplete;progressAssessment: string; } | {objectiveFailed: {kind: "ObjectiveFailed";result: failureReason;url: string; }; }>

Defined in

src/nolita.ts:69