Buckets:

immErfanrajabee/bd / function-declarations.ts
imerfanrajabee's picture
download
raw
12.4 kB
import { FunctionDeclaration, Type } from '@google/genai';
export const browseToSiteDeclaration: FunctionDeclaration = {
name: 'browseToSite',
description: 'Navigate to one of the Ilam Power Company websites or any other URL using the automated browser',
parameters: {
type: Type.OBJECT,
properties: {
site: {
type: Type.STRING,
enum: ['ilamedc', 'eserv', 'bargheman', 'custom'],
description: 'Which site to navigate to: ilamedc (main portal), eserv (bill viewing), bargheman (payment), or custom (any URL)',
},
url: {
type: Type.STRING,
description: 'Custom URL if site is "custom"',
},
},
required: ['site'],
},
};
export const fillFormFieldDeclaration: FunctionDeclaration = {
name: 'fillFormField',
description: 'Fill a specific form field on the currently browsed page',
parameters: {
type: Type.OBJECT,
properties: {
fieldSelector: {
type: Type.STRING,
description: 'CSS selector for the form field (input, textarea, select)',
},
value: {
type: Type.STRING,
description: 'The value to fill in the field',
},
fieldDescription: {
type: Type.STRING,
description: 'A human-readable description of this field in Persian (e.g. "نام کاربری", "رمز عبور", "شناسه قبض")',
},
},
required: ['fieldSelector', 'value', 'fieldDescription'],
},
};
export const clickElementDeclaration: FunctionDeclaration = {
name: 'clickElement',
description: 'Click an element (button, link, checkbox) on the current page',
parameters: {
type: Type.OBJECT,
properties: {
selector: {
type: Type.STRING,
description: 'CSS selector for the element to click',
},
description: {
type: Type.STRING,
description: 'What is being clicked (Persian description like "دکمه ورود", "لینک مشاهده قبض")',
},
},
required: ['selector', 'description'],
},
};
export const waitForElementDeclaration: FunctionDeclaration = {
name: 'waitForElement',
description: 'Wait for a specific element to appear on the page before proceeding',
parameters: {
type: Type.OBJECT,
properties: {
selector: {
type: Type.STRING,
description: 'CSS selector to wait for',
},
description: {
type: Type.STRING,
description: 'Description of what we are waiting for in Persian',
},
timeout: {
type: Type.NUMBER,
description: 'Maximum wait time in milliseconds (default: 15000)',
},
},
required: ['selector', 'description'],
},
};
export const extractPageInfoDeclaration: FunctionDeclaration = {
name: 'extractPageInfo',
description: 'Extract text, HTML, or take a screenshot of the current page to read information',
parameters: {
type: Type.OBJECT,
properties: {
type: {
type: Type.STRING,
enum: ['text', 'screenshot', 'html', 'url'],
description: 'What type of information to extract: text (all visible text), screenshot (image), html (page source), url (current address)',
},
description: {
type: Type.STRING,
description: 'What information you are looking for in Persian (e.g. "مبلغ قبض", "اطلاعات خاموشی", "اخبار جدید")',
},
},
required: ['type', 'description'],
},
};
export const executePlanDeclaration: FunctionDeclaration = {
name: 'executePlan',
description: 'Execute a multi-step plan automatically to accomplish a task on the power company websites',
parameters: {
type: Type.OBJECT,
properties: {
taskName: {
type: Type.STRING,
description: 'The name of the predefined task to execute',
enum: [
'check_bill',
'pay_bill',
'view_electronic_bill',
'check_outage',
'register_phone',
'read_news',
'contact_ceo',
'login_bargheman',
],
},
params: {
type: Type.STRING,
description: 'JSON string of parameters needed for the task (e.g., {"bornehId":"123456","mobile":"09121234567"})',
},
},
required: ['taskName'],
},
};
export const selectOptionDeclaration: FunctionDeclaration = {
name: 'selectOption',
description: 'Select an option from a dropdown/select element on the page',
parameters: {
type: Type.OBJECT,
properties: {
selector: {
type: Type.STRING,
description: 'CSS selector for the select element',
},
value: {
type: Type.STRING,
description: 'The option value or label to select',
},
description: {
type: Type.STRING,
description: 'Description of what we are selecting in Persian',
},
},
required: ['selector', 'value', 'description'],
},
};
export const getSiteGuideDeclaration: FunctionDeclaration = {
name: 'getSiteGuide',
description: 'Get a comprehensive guide to all features and pages available on the Ilam power company websites',
parameters: {
type: Type.OBJECT,
properties: {
topic: {
type: Type.STRING,
description: 'Optional: specific topic to get guidance on (e.g. "پرداخت قبض", "خاموشی", "قبوض", "انشعاب")',
},
},
required: [],
},
};
export const displayChartDeclaration: FunctionDeclaration = {
name: 'displayChart',
description: 'Generate and display a visual chart (bar, line, pie, doughnut, area, horizontalBar) with structured data. Use this to present data visually for better understanding.',
parameters: {
type: Type.OBJECT,
properties: {
type: {
type: Type.STRING,
enum: ['bar', 'line', 'pie', 'doughnut', 'area', 'horizontalBar'],
description: 'Chart type: bar (vertical bars), line (trend line), pie (circular), doughnut (ring), area (filled line), horizontalBar (horizontal bars)',
},
title: {
type: Type.STRING,
description: 'Chart title in Persian',
},
labels: {
type: Type.STRING,
description: 'JSON string array of data point labels, e.g. ["فروردین","اردیبهشت","خرداد"]',
},
values: {
type: Type.STRING,
description: 'JSON string array of numeric values, e.g. [120, 85, 200]',
},
colors: {
type: Type.STRING,
description: 'Optional JSON string array of hex color codes, e.g. ["#4f8cf7","#22c55e"]',
},
yAxisLabel: {
type: Type.STRING,
description: 'Label for Y axis (Persian)',
},
},
required: ['type', 'title', 'labels', 'values'],
},
};
export const displayTableDeclaration: FunctionDeclaration = {
name: 'displayTable',
description: 'Display data in a formatted table with headers and rows. Use for structured data like bills, comparisons, lists.',
parameters: {
type: Type.OBJECT,
properties: {
title: {
type: Type.STRING,
description: 'Table title in Persian',
},
headers: {
type: Type.STRING,
description: 'JSON string array of column headers, e.g. ["ردیف","محصول","قیمت"]',
},
rows: {
type: Type.STRING,
description: 'JSON string of 2D array for rows, e.g. [["1","برق","12000"],["2","گاز","8000"]]',
},
},
required: ['title', 'headers', 'rows'],
},
};
export const displayMetricsDeclaration: FunctionDeclaration = {
name: 'displayMetrics',
description: 'Display key metrics/numbers in modern card format. Use for KPIs, statistics, summaries.',
parameters: {
type: Type.OBJECT,
properties: {
title: {
type: Type.STRING,
description: 'Section title in Persian',
},
metrics: {
type: Type.STRING,
description: 'JSON string array of metric objects. Each object: {label, value, change?, trend?("up"|"down"|"neutral"), subtitle?}, e.g. [{"label":"مصرف","value":"320 کیلووات","change":"+12%","trend":"up"}]',
},
},
required: ['title', 'metrics'],
},
};
export const displayReportDeclaration: FunctionDeclaration = {
name: 'displayReport',
description: 'Display a comprehensive multi-section report with text, charts, tables, and images. Use for detailed professional reports.',
parameters: {
type: Type.OBJECT,
properties: {
title: {
type: Type.STRING,
description: 'Report title in Persian',
},
sections: {
type: Type.STRING,
description: 'JSON string array of report sections. Each section: {title, body(optional), chart(optional same format as displayChart), table(optional same format as displayTable)}. Example: [{"title":"خلاصه","body":"متن گزارش..."},{"title":"نمودار","chart":{"type":"bar","title":"مصرف","labels":["...","..."],"values":[1,2]}}]',
},
},
required: ['title', 'sections'],
},
};
export const displayImageDeclaration: FunctionDeclaration = {
name: 'displayImage',
description: 'Display an image from a URL or base64 data URI in the rich content panel',
parameters: {
type: Type.OBJECT,
properties: {
title: {
type: Type.STRING,
description: 'Image title in Persian',
},
src: {
type: Type.STRING,
description: 'Image URL or base64 data URI (e.g. from a screenshot)',
},
caption: {
type: Type.STRING,
description: 'Optional caption text in Persian',
},
},
required: ['title', 'src'],
},
};
export const chartToolDeclarations: FunctionDeclaration[] = [
displayChartDeclaration,
displayTableDeclaration,
displayMetricsDeclaration,
displayReportDeclaration,
displayImageDeclaration,
];
// ── Phone / VoIP function declarations ──
export const makeCallDeclaration: FunctionDeclaration = {
name: 'makeCall',
description: 'Make a phone call to a peer via the internal VoIP system. Use this when the user wants to call someone.',
parameters: {
type: Type.OBJECT,
properties: {
peerId: {
type: Type.STRING,
description: 'The peer ID or phone number to call',
},
displayName: {
type: Type.STRING,
description: 'The display name of the person to call (Persian)',
},
},
required: ['peerId', 'displayName'],
},
};
export const hangUpCallDeclaration: FunctionDeclaration = {
name: 'hangUpCall',
description: 'Hang up the currently active call',
parameters: {
type: Type.OBJECT,
properties: {},
required: [],
},
};
export const getCallHistoryDeclaration: FunctionDeclaration = {
name: 'getCallHistory',
description: 'Retrieve recent call history from the local call database',
parameters: {
type: Type.OBJECT,
properties: {
limit: {
type: Type.NUMBER,
description: 'Maximum number of log entries to return (default: 20)',
},
},
required: [],
},
};
export const getContactsDeclaration: FunctionDeclaration = {
name: 'getContacts',
description: 'Retrieve saved contacts from the local phone database',
parameters: {
type: Type.OBJECT,
properties: {
query: {
type: Type.STRING,
description: 'Optional search query to filter contacts by name or phone',
},
},
required: [],
},
};
export const addContactDeclaration: FunctionDeclaration = {
name: 'addContact',
description: 'Add a new contact to the local phone database',
parameters: {
type: Type.OBJECT,
properties: {
name: {
type: Type.STRING,
description: 'Contact name in Persian',
},
phone: {
type: Type.STRING,
description: 'Phone number of the contact',
},
},
required: ['name', 'phone'],
},
};
export const phoneDeclarations: FunctionDeclaration[] = [
makeCallDeclaration,
hangUpCallDeclaration,
getCallHistoryDeclaration,
getContactsDeclaration,
addContactDeclaration,
];
export const allFunctionDeclarations: FunctionDeclaration[] = [
browseToSiteDeclaration,
fillFormFieldDeclaration,
clickElementDeclaration,
waitForElementDeclaration,
extractPageInfoDeclaration,
executePlanDeclaration,
selectOptionDeclaration,
getSiteGuideDeclaration,
...chartToolDeclarations,
...phoneDeclarations,
];

Xet Storage Details

Size:
12.4 kB
·
Xet hash:
3d110aa3e6e54eb00caf621e65849a3755a7d2007af040ff18e157340fe35f46

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.