Skip to Content
Mika Scraper 1.1.1 is released ๐ŸŽ‰
๐ŸŒŠ MIKA CLASSClass: ChatUpAI

Mika Scraper v1.1.2


Mika Scraper / ChatUpAI

Class: ChatUpAI

Defined in: src/_other-scraper/chatup-ai.ts:114

The ChatUpAI SDK serves as a core wrapper for interacting with the ChatUpAI.org API. It provides methods that facilitate the following functionalities:

  • Chat completions
  • Image generation
  • Web browsing
  • PDF-to-text extraction

Example Usage

const response = await ChatUpAI.chat("Hello, what is AI?"); console.log(response.result);

Constructors

Constructor

new ChatUpAI(): ChatUpAI

Returns

An instance of ChatUpAI.

Methods

generateId()

static generateId(): string

Defined in: src/_other-scraper/chatup-ai.ts:131

Generates a unique hexadecimal session identifier.

Returns

string - A secure 16-character session ID.


cleanupSessions()

static cleanupSessions(): void

Defined in: src/_other-scraper/chatup-ai.ts:140

Removes expired sessions from memory. This method is executed internally after each chat operation to ensure optimal resource management.

Returns

void


chat()

static chat(input: string, sessionId?: string): Promise<ChatResponse>

Defined in: src/_other-scraper/chatup-ai.ts:162

Sends a chat message to ChatUpAI and receives a corresponding AI-generated response.

Parameters

  • input: string - The userโ€™s input message.
  • sessionId?: string - An optional session ID to maintain context across messages.

Returns

Promise<ChatResponse> - A promise that resolves to a ChatResponse object containing the AIโ€™s reply.

Example

const reply = await ChatUpAI.chat("What is quantum computing?"); console.log(reply.result);

generateImage()

static generateImage(prompt: string, n: number = 1, size: string = '1024x1024'): Promise<ImageResponse>

Defined in: src/_other-scraper/chatup-ai.ts:243

Generates an image based on a descriptive text prompt.

Parameters

  • prompt: string - A textual description used to create the image.
  • n: number - The number of images to generate (default is 1).
  • size: string - The dimensions of the image (default is โ€˜1024x1024โ€™).

Returns

Promise<ImageResponse> - A promise that resolves to an ImageResponse object containing the generated imageโ€™s URL and content.

Example

const result = await ChatUpAI.generateImage("A forest in neon colors"); console.log(result.imageUrl);

browsing()

static browsing(input: string): Promise<BrowseResponse>

Defined in: src/_other-scraper/chatup-ai.ts:298

Performs web browsing based on the specified user query.

Parameters

  • input: string - A query or search term to conduct the browsing operation.

Returns

Promise<BrowseResponse> - A promise that resolves to a BrowseResponse object containing a summary, URLs, and suggestions based on the query.

Example

const info = await ChatUpAI.browsing("Who won the 2024 election?"); console.log(info.description);

pdf2Text()

static pdf2Text(filePath: string): Promise<PdfTextResponse>

Defined in: src/_other-scraper/chatup-ai.ts:350

Converts a local PDF file into extracted plain text.

Parameters

  • filePath: string - The file path to the PDF document to be converted.

Returns

Promise<PdfTextResponse> - A promise that resolves to a PdfTextResponse object containing the extracted text or an error message.

Example

const text = await ChatUpAI.pdf2Text("./document.pdf"); console.log(text.data);
Last updated on