langchain 0.0.157 → 0.0.159

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/dist/chat_models/bedrock.cjs +28 -13
  2. package/dist/chat_models/bedrock.d.ts +6 -1
  3. package/dist/chat_models/bedrock.js +28 -13
  4. package/dist/llms/bedrock.cjs +29 -13
  5. package/dist/llms/bedrock.d.ts +6 -1
  6. package/dist/llms/bedrock.js +29 -13
  7. package/dist/load/import_constants.cjs +1 -0
  8. package/dist/load/import_constants.js +1 -0
  9. package/dist/prompts/few_shot.d.ts +1 -1
  10. package/dist/prompts/prompt.cjs +0 -3
  11. package/dist/prompts/prompt.d.ts +1 -1
  12. package/dist/prompts/prompt.js +0 -3
  13. package/dist/prompts/template.cjs +0 -2
  14. package/dist/prompts/template.d.ts +3 -3
  15. package/dist/prompts/template.js +0 -2
  16. package/dist/tools/google_calendar/base.cjs +94 -0
  17. package/dist/tools/google_calendar/base.d.ts +24 -0
  18. package/dist/tools/google_calendar/base.js +90 -0
  19. package/dist/tools/google_calendar/commands/run-create-events.cjs +71 -0
  20. package/dist/tools/google_calendar/commands/run-create-events.d.ts +10 -0
  21. package/dist/tools/google_calendar/commands/run-create-events.js +68 -0
  22. package/dist/tools/google_calendar/commands/run-view-events.cjs +50 -0
  23. package/dist/tools/google_calendar/commands/run-view-events.d.ts +10 -0
  24. package/dist/tools/google_calendar/commands/run-view-events.js +47 -0
  25. package/dist/tools/google_calendar/create.cjs +33 -0
  26. package/dist/tools/google_calendar/create.d.ts +8 -0
  27. package/dist/tools/google_calendar/create.js +29 -0
  28. package/dist/tools/google_calendar/descriptions.cjs +26 -0
  29. package/dist/tools/google_calendar/descriptions.d.ts +2 -0
  30. package/dist/tools/google_calendar/descriptions.js +23 -0
  31. package/dist/tools/google_calendar/index.cjs +7 -0
  32. package/dist/tools/google_calendar/index.d.ts +3 -0
  33. package/dist/tools/google_calendar/index.js +2 -0
  34. package/dist/tools/google_calendar/prompts/create-event-prompt.cjs +59 -0
  35. package/dist/tools/google_calendar/prompts/create-event-prompt.d.ts +1 -0
  36. package/dist/tools/google_calendar/prompts/create-event-prompt.js +56 -0
  37. package/dist/tools/google_calendar/prompts/index.cjs +7 -0
  38. package/dist/tools/google_calendar/prompts/index.d.ts +2 -0
  39. package/dist/tools/google_calendar/prompts/index.js +2 -0
  40. package/dist/tools/google_calendar/prompts/view-events-prompt.cjs +37 -0
  41. package/dist/tools/google_calendar/prompts/view-events-prompt.d.ts +1 -0
  42. package/dist/tools/google_calendar/prompts/view-events-prompt.js +34 -0
  43. package/dist/tools/google_calendar/utils/get-timezone-offset-in-hours.cjs +9 -0
  44. package/dist/tools/google_calendar/utils/get-timezone-offset-in-hours.d.ts +2 -0
  45. package/dist/tools/google_calendar/utils/get-timezone-offset-in-hours.js +6 -0
  46. package/dist/tools/google_calendar/view.cjs +33 -0
  47. package/dist/tools/google_calendar/view.d.ts +8 -0
  48. package/dist/tools/google_calendar/view.js +29 -0
  49. package/dist/vectorstores/vectara.cjs +9 -0
  50. package/dist/vectorstores/vectara.d.ts +3 -0
  51. package/dist/vectorstores/vectara.js +9 -0
  52. package/package.json +15 -2
  53. package/tools/google_calendar.cjs +1 -0
  54. package/tools/google_calendar.d.ts +1 -0
  55. package/tools/google_calendar.js +1 -0
@@ -0,0 +1,68 @@
1
+ import { google } from "googleapis";
2
+ import { PromptTemplate } from "../../../prompts/index.js";
3
+ import { LLMChain } from "../../../chains/index.js";
4
+ import { CREATE_EVENT_PROMPT } from "../prompts/index.js";
5
+ import { getTimezoneOffsetInHours } from "../utils/get-timezone-offset-in-hours.js";
6
+ const createEvent = async ({ eventSummary, eventStartTime, eventEndTime, userTimezone, eventLocation = "", eventDescription = "", }, calendarId, auth) => {
7
+ const calendar = google.calendar("v3");
8
+ const event = {
9
+ summary: eventSummary,
10
+ location: eventLocation,
11
+ description: eventDescription,
12
+ start: {
13
+ dateTime: eventStartTime,
14
+ timeZone: userTimezone,
15
+ },
16
+ end: {
17
+ dateTime: eventEndTime,
18
+ timeZone: userTimezone,
19
+ },
20
+ };
21
+ try {
22
+ const createdEvent = await calendar.events.insert({
23
+ auth,
24
+ calendarId,
25
+ requestBody: event,
26
+ });
27
+ return createdEvent;
28
+ }
29
+ catch (error) {
30
+ return {
31
+ error: `An error occurred: ${error}`,
32
+ };
33
+ }
34
+ };
35
+ const runCreateEvent = async (query, { calendarId, auth, model }, runManager) => {
36
+ const prompt = new PromptTemplate({
37
+ template: CREATE_EVENT_PROMPT,
38
+ inputVariables: ["date", "query", "u_timezone", "dayName"],
39
+ });
40
+ const createEventChain = new LLMChain({
41
+ llm: model,
42
+ prompt,
43
+ });
44
+ const date = new Date().toISOString();
45
+ const u_timezone = getTimezoneOffsetInHours();
46
+ const dayName = new Date().toLocaleString("en-us", { weekday: "long" });
47
+ const output = await createEventChain.call({
48
+ query,
49
+ date,
50
+ u_timezone,
51
+ dayName,
52
+ }, runManager?.getChild());
53
+ const loaded = JSON.parse(output.text);
54
+ const [eventSummary, eventStartTime, eventEndTime, eventLocation, eventDescription, userTimezone,] = Object.values(loaded);
55
+ const event = await createEvent({
56
+ eventSummary,
57
+ eventStartTime,
58
+ eventEndTime,
59
+ userTimezone,
60
+ eventLocation,
61
+ eventDescription,
62
+ }, calendarId, auth);
63
+ if (!event.error) {
64
+ return `Event created successfully, details: event ${event.data.htmlLink}`;
65
+ }
66
+ return `An error occurred creating the event: ${event.error}`;
67
+ };
68
+ export { runCreateEvent };
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.runViewEvents = void 0;
4
+ const googleapis_1 = require("googleapis");
5
+ const index_js_1 = require("../../../prompts/index.cjs");
6
+ const index_js_2 = require("../../../chains/index.cjs");
7
+ const index_js_3 = require("../prompts/index.cjs");
8
+ const get_timezone_offset_in_hours_js_1 = require("../utils/get-timezone-offset-in-hours.cjs");
9
+ const runViewEvents = async (query, { model, auth, calendarId }, runManager) => {
10
+ const calendar = new googleapis_1.calendar_v3.Calendar({});
11
+ const prompt = new index_js_1.PromptTemplate({
12
+ template: index_js_3.VIEW_EVENTS_PROMPT,
13
+ inputVariables: ["date", "query", "u_timezone", "dayName"],
14
+ });
15
+ const viewEventsChain = new index_js_2.LLMChain({
16
+ llm: model,
17
+ prompt,
18
+ });
19
+ const date = new Date().toISOString();
20
+ const u_timezone = (0, get_timezone_offset_in_hours_js_1.getTimezoneOffsetInHours)();
21
+ const dayName = new Date().toLocaleString("en-us", { weekday: "long" });
22
+ const output = await viewEventsChain.call({
23
+ query,
24
+ date,
25
+ u_timezone,
26
+ dayName,
27
+ }, runManager?.getChild());
28
+ const loaded = JSON.parse(output.text);
29
+ try {
30
+ const response = await calendar.events.list({
31
+ auth,
32
+ calendarId,
33
+ ...loaded,
34
+ });
35
+ const curatedItems = response.data && response.data.items
36
+ ? response.data.items.map(({ status, summary, description, start, end, }) => ({
37
+ status,
38
+ summary,
39
+ description,
40
+ start,
41
+ end,
42
+ }))
43
+ : [];
44
+ return `Result for the prompt "${query}": \n${JSON.stringify(curatedItems, null, 2)}`;
45
+ }
46
+ catch (error) {
47
+ return `An error occurred: ${error}`;
48
+ }
49
+ };
50
+ exports.runViewEvents = runViewEvents;
@@ -0,0 +1,10 @@
1
+ import type { JWT } from "googleapis-common";
2
+ import { BaseLLM } from "../../../llms/base.js";
3
+ import { CallbackManagerForToolRun } from "../../../callbacks/manager.js";
4
+ type RunViewEventParams = {
5
+ calendarId: string;
6
+ auth: JWT;
7
+ model: BaseLLM;
8
+ };
9
+ declare const runViewEvents: (query: string, { model, auth, calendarId }: RunViewEventParams, runManager?: CallbackManagerForToolRun) => Promise<string>;
10
+ export { runViewEvents };
@@ -0,0 +1,47 @@
1
+ import { calendar_v3 } from "googleapis";
2
+ import { PromptTemplate } from "../../../prompts/index.js";
3
+ import { LLMChain } from "../../../chains/index.js";
4
+ import { VIEW_EVENTS_PROMPT } from "../prompts/index.js";
5
+ import { getTimezoneOffsetInHours } from "../utils/get-timezone-offset-in-hours.js";
6
+ const runViewEvents = async (query, { model, auth, calendarId }, runManager) => {
7
+ const calendar = new calendar_v3.Calendar({});
8
+ const prompt = new PromptTemplate({
9
+ template: VIEW_EVENTS_PROMPT,
10
+ inputVariables: ["date", "query", "u_timezone", "dayName"],
11
+ });
12
+ const viewEventsChain = new LLMChain({
13
+ llm: model,
14
+ prompt,
15
+ });
16
+ const date = new Date().toISOString();
17
+ const u_timezone = getTimezoneOffsetInHours();
18
+ const dayName = new Date().toLocaleString("en-us", { weekday: "long" });
19
+ const output = await viewEventsChain.call({
20
+ query,
21
+ date,
22
+ u_timezone,
23
+ dayName,
24
+ }, runManager?.getChild());
25
+ const loaded = JSON.parse(output.text);
26
+ try {
27
+ const response = await calendar.events.list({
28
+ auth,
29
+ calendarId,
30
+ ...loaded,
31
+ });
32
+ const curatedItems = response.data && response.data.items
33
+ ? response.data.items.map(({ status, summary, description, start, end, }) => ({
34
+ status,
35
+ summary,
36
+ description,
37
+ start,
38
+ end,
39
+ }))
40
+ : [];
41
+ return `Result for the prompt "${query}": \n${JSON.stringify(curatedItems, null, 2)}`;
42
+ }
43
+ catch (error) {
44
+ return `An error occurred: ${error}`;
45
+ }
46
+ };
47
+ export { runViewEvents };
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GoogleCalendarCreateTool = void 0;
4
+ const base_js_1 = require("./base.cjs");
5
+ const run_create_events_js_1 = require("./commands/run-create-events.cjs");
6
+ const descriptions_js_1 = require("./descriptions.cjs");
7
+ class GoogleCalendarCreateTool extends base_js_1.GoogleCalendarBase {
8
+ constructor(fields) {
9
+ super(fields);
10
+ Object.defineProperty(this, "name", {
11
+ enumerable: true,
12
+ configurable: true,
13
+ writable: true,
14
+ value: "google_calendar_create"
15
+ });
16
+ Object.defineProperty(this, "description", {
17
+ enumerable: true,
18
+ configurable: true,
19
+ writable: true,
20
+ value: descriptions_js_1.CREATE_TOOL_DESCRIPTION
21
+ });
22
+ }
23
+ async _call(query, runManager) {
24
+ const auth = await this.getAuth();
25
+ const model = this.getModel();
26
+ return (0, run_create_events_js_1.runCreateEvent)(query, {
27
+ auth,
28
+ model,
29
+ calendarId: this.calendarId,
30
+ }, runManager);
31
+ }
32
+ }
33
+ exports.GoogleCalendarCreateTool = GoogleCalendarCreateTool;
@@ -0,0 +1,8 @@
1
+ import { CallbackManagerForToolRun } from "../../callbacks/manager.js";
2
+ import { GoogleCalendarBase, GoogleCalendarAgentParams } from "./base.js";
3
+ export declare class GoogleCalendarCreateTool extends GoogleCalendarBase {
4
+ name: string;
5
+ description: string;
6
+ constructor(fields: GoogleCalendarAgentParams);
7
+ _call(query: string, runManager?: CallbackManagerForToolRun): Promise<string>;
8
+ }
@@ -0,0 +1,29 @@
1
+ import { GoogleCalendarBase } from "./base.js";
2
+ import { runCreateEvent } from "./commands/run-create-events.js";
3
+ import { CREATE_TOOL_DESCRIPTION } from "./descriptions.js";
4
+ export class GoogleCalendarCreateTool extends GoogleCalendarBase {
5
+ constructor(fields) {
6
+ super(fields);
7
+ Object.defineProperty(this, "name", {
8
+ enumerable: true,
9
+ configurable: true,
10
+ writable: true,
11
+ value: "google_calendar_create"
12
+ });
13
+ Object.defineProperty(this, "description", {
14
+ enumerable: true,
15
+ configurable: true,
16
+ writable: true,
17
+ value: CREATE_TOOL_DESCRIPTION
18
+ });
19
+ }
20
+ async _call(query, runManager) {
21
+ const auth = await this.getAuth();
22
+ const model = this.getModel();
23
+ return runCreateEvent(query, {
24
+ auth,
25
+ model,
26
+ calendarId: this.calendarId,
27
+ }, runManager);
28
+ }
29
+ }
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.VIEW_TOOL_DESCRIPTION = exports.CREATE_TOOL_DESCRIPTION = void 0;
4
+ exports.CREATE_TOOL_DESCRIPTION = `A tool for creating Google Calendar events and meetings.
5
+
6
+ INPUT example:
7
+ "action": "google_calendar_create",
8
+ "action_input": "create a new meeting with John Doe tomorrow at 4pm"
9
+
10
+ OUTPUT:
11
+ Output is a confirmation of a created event.
12
+ `;
13
+ exports.VIEW_TOOL_DESCRIPTION = `A tool for retrieving Google Calendar events and meetings.
14
+ INPUT examples:
15
+ "action": "google_calendar_view",
16
+ "action_input": "display meetings for today"
17
+
18
+ "action": "google_calendar_view",
19
+ "action_input": "show events for tomorrow"
20
+
21
+ "action": "google_calendar_view",
22
+ "action_input": "display meetings for tomorrow between 4pm and 8pm"
23
+
24
+ OUTPUT:
25
+ - title, start time, end time, attendees, description (if available)
26
+ `;
@@ -0,0 +1,2 @@
1
+ export declare const CREATE_TOOL_DESCRIPTION = "A tool for creating Google Calendar events and meetings.\n\nINPUT example:\n\"action\": \"google_calendar_create\",\n\"action_input\": \"create a new meeting with John Doe tomorrow at 4pm\"\n\nOUTPUT:\nOutput is a confirmation of a created event.\n";
2
+ export declare const VIEW_TOOL_DESCRIPTION = "A tool for retrieving Google Calendar events and meetings.\nINPUT examples:\n\"action\": \"google_calendar_view\",\n\"action_input\": \"display meetings for today\"\n\n\"action\": \"google_calendar_view\",\n\"action_input\": \"show events for tomorrow\"\n\n\"action\": \"google_calendar_view\",\n\"action_input\": \"display meetings for tomorrow between 4pm and 8pm\"\n\nOUTPUT:\n- title, start time, end time, attendees, description (if available)\n";
@@ -0,0 +1,23 @@
1
+ export const CREATE_TOOL_DESCRIPTION = `A tool for creating Google Calendar events and meetings.
2
+
3
+ INPUT example:
4
+ "action": "google_calendar_create",
5
+ "action_input": "create a new meeting with John Doe tomorrow at 4pm"
6
+
7
+ OUTPUT:
8
+ Output is a confirmation of a created event.
9
+ `;
10
+ export const VIEW_TOOL_DESCRIPTION = `A tool for retrieving Google Calendar events and meetings.
11
+ INPUT examples:
12
+ "action": "google_calendar_view",
13
+ "action_input": "display meetings for today"
14
+
15
+ "action": "google_calendar_view",
16
+ "action_input": "show events for tomorrow"
17
+
18
+ "action": "google_calendar_view",
19
+ "action_input": "display meetings for tomorrow between 4pm and 8pm"
20
+
21
+ OUTPUT:
22
+ - title, start time, end time, attendees, description (if available)
23
+ `;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GoogleCalendarViewTool = exports.GoogleCalendarCreateTool = void 0;
4
+ var create_js_1 = require("./create.cjs");
5
+ Object.defineProperty(exports, "GoogleCalendarCreateTool", { enumerable: true, get: function () { return create_js_1.GoogleCalendarCreateTool; } });
6
+ var view_js_1 = require("./view.cjs");
7
+ Object.defineProperty(exports, "GoogleCalendarViewTool", { enumerable: true, get: function () { return view_js_1.GoogleCalendarViewTool; } });
@@ -0,0 +1,3 @@
1
+ export { GoogleCalendarCreateTool } from "./create.js";
2
+ export { GoogleCalendarViewTool } from "./view.js";
3
+ export type { GoogleCalendarAgentParams } from "./base.js";
@@ -0,0 +1,2 @@
1
+ export { GoogleCalendarCreateTool } from "./create.js";
2
+ export { GoogleCalendarViewTool } from "./view.js";
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CREATE_EVENT_PROMPT = void 0;
4
+ exports.CREATE_EVENT_PROMPT = `
5
+ Date format: YYYY-MM-DDThh:mm:ss+00:00
6
+ Based on this event description: "Joey birthday tomorrow at 7 pm",
7
+ output a json of the following parameters:
8
+ Today's datetime on UTC time 2023-05-02T10:00:00+00:00, it's Tuesday and timezone
9
+ of the user is -5, take into account the timezone of the user and today's date.
10
+ 1. event_summary
11
+ 2. event_start_time
12
+ 3. event_end_time
13
+ 4. event_location
14
+ 5. event_description
15
+ 6. user_timezone
16
+ event_summary:
17
+ {{
18
+ "event_summary": "Joey birthday",
19
+ "event_start_time": "2023-05-03T19:00:00-05:00",
20
+ "event_end_time": "2023-05-03T20:00:00-05:00",
21
+ "event_location": "",
22
+ "event_description": "",
23
+ "user_timezone": "America/New_York"
24
+ }}
25
+
26
+ Date format: YYYY-MM-DDThh:mm:ss+00:00
27
+ Based on this event description: "Create a meeting for 5 pm on Saturday with Joey",
28
+ output a json of the following parameters:
29
+ Today's datetime on UTC time 2023-05-04T10:00:00+00:00, it's Thursday and timezone
30
+ of the user is -5, take into account the timezone of the user and today's date.
31
+ 1. event_summary
32
+ 2. event_start_time
33
+ 3. event_end_time
34
+ 4. event_location
35
+ 5. event_description
36
+ 6. user_timezone
37
+ event_summary:
38
+ {{
39
+ "event_summary": "Meeting with Joey",
40
+ "event_start_time": "2023-05-06T17:00:00-05:00",
41
+ "event_end_time": "2023-05-06T18:00:00-05:00",
42
+ "event_location": "",
43
+ "event_description": "",
44
+ "user_timezone": "America/New_York"
45
+ }}
46
+
47
+ Date format: YYYY-MM-DDThh:mm:ss+00:00
48
+ Based on this event description: "{query}", output a json of the
49
+ following parameters:
50
+ Today's datetime on UTC time {date}, it's {dayName} and timezone of the user {u_timezone},
51
+ take into account the timezone of the user and today's date.
52
+ 1. event_summary
53
+ 2. event_start_time
54
+ 3. event_end_time
55
+ 4. event_location
56
+ 5. event_description
57
+ 6. user_timezone
58
+ event_summary:
59
+ `;
@@ -0,0 +1 @@
1
+ export declare const CREATE_EVENT_PROMPT = "\nDate format: YYYY-MM-DDThh:mm:ss+00:00\nBased on this event description: \"Joey birthday tomorrow at 7 pm\",\noutput a json of the following parameters: \nToday's datetime on UTC time 2023-05-02T10:00:00+00:00, it's Tuesday and timezone\nof the user is -5, take into account the timezone of the user and today's date.\n1. event_summary \n2. event_start_time \n3. event_end_time \n4. event_location \n5. event_description \n6. user_timezone\nevent_summary:\n{{\n \"event_summary\": \"Joey birthday\",\n \"event_start_time\": \"2023-05-03T19:00:00-05:00\",\n \"event_end_time\": \"2023-05-03T20:00:00-05:00\",\n \"event_location\": \"\",\n \"event_description\": \"\",\n \"user_timezone\": \"America/New_York\"\n}}\n\nDate format: YYYY-MM-DDThh:mm:ss+00:00\nBased on this event description: \"Create a meeting for 5 pm on Saturday with Joey\",\noutput a json of the following parameters: \nToday's datetime on UTC time 2023-05-04T10:00:00+00:00, it's Thursday and timezone\nof the user is -5, take into account the timezone of the user and today's date.\n1. event_summary \n2. event_start_time \n3. event_end_time \n4. event_location \n5. event_description \n6. user_timezone\nevent_summary:\n{{\n \"event_summary\": \"Meeting with Joey\",\n \"event_start_time\": \"2023-05-06T17:00:00-05:00\",\n \"event_end_time\": \"2023-05-06T18:00:00-05:00\",\n \"event_location\": \"\",\n \"event_description\": \"\",\n \"user_timezone\": \"America/New_York\"\n}}\n\nDate format: YYYY-MM-DDThh:mm:ss+00:00\nBased on this event description: \"{query}\", output a json of the\nfollowing parameters: \nToday's datetime on UTC time {date}, it's {dayName} and timezone of the user {u_timezone},\ntake into account the timezone of the user and today's date.\n1. event_summary \n2. event_start_time \n3. event_end_time \n4. event_location \n5. event_description \n6. user_timezone \nevent_summary:\n";
@@ -0,0 +1,56 @@
1
+ export const CREATE_EVENT_PROMPT = `
2
+ Date format: YYYY-MM-DDThh:mm:ss+00:00
3
+ Based on this event description: "Joey birthday tomorrow at 7 pm",
4
+ output a json of the following parameters:
5
+ Today's datetime on UTC time 2023-05-02T10:00:00+00:00, it's Tuesday and timezone
6
+ of the user is -5, take into account the timezone of the user and today's date.
7
+ 1. event_summary
8
+ 2. event_start_time
9
+ 3. event_end_time
10
+ 4. event_location
11
+ 5. event_description
12
+ 6. user_timezone
13
+ event_summary:
14
+ {{
15
+ "event_summary": "Joey birthday",
16
+ "event_start_time": "2023-05-03T19:00:00-05:00",
17
+ "event_end_time": "2023-05-03T20:00:00-05:00",
18
+ "event_location": "",
19
+ "event_description": "",
20
+ "user_timezone": "America/New_York"
21
+ }}
22
+
23
+ Date format: YYYY-MM-DDThh:mm:ss+00:00
24
+ Based on this event description: "Create a meeting for 5 pm on Saturday with Joey",
25
+ output a json of the following parameters:
26
+ Today's datetime on UTC time 2023-05-04T10:00:00+00:00, it's Thursday and timezone
27
+ of the user is -5, take into account the timezone of the user and today's date.
28
+ 1. event_summary
29
+ 2. event_start_time
30
+ 3. event_end_time
31
+ 4. event_location
32
+ 5. event_description
33
+ 6. user_timezone
34
+ event_summary:
35
+ {{
36
+ "event_summary": "Meeting with Joey",
37
+ "event_start_time": "2023-05-06T17:00:00-05:00",
38
+ "event_end_time": "2023-05-06T18:00:00-05:00",
39
+ "event_location": "",
40
+ "event_description": "",
41
+ "user_timezone": "America/New_York"
42
+ }}
43
+
44
+ Date format: YYYY-MM-DDThh:mm:ss+00:00
45
+ Based on this event description: "{query}", output a json of the
46
+ following parameters:
47
+ Today's datetime on UTC time {date}, it's {dayName} and timezone of the user {u_timezone},
48
+ take into account the timezone of the user and today's date.
49
+ 1. event_summary
50
+ 2. event_start_time
51
+ 3. event_end_time
52
+ 4. event_location
53
+ 5. event_description
54
+ 6. user_timezone
55
+ event_summary:
56
+ `;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.VIEW_EVENTS_PROMPT = exports.CREATE_EVENT_PROMPT = void 0;
4
+ var create_event_prompt_js_1 = require("./create-event-prompt.cjs");
5
+ Object.defineProperty(exports, "CREATE_EVENT_PROMPT", { enumerable: true, get: function () { return create_event_prompt_js_1.CREATE_EVENT_PROMPT; } });
6
+ var view_events_prompt_js_1 = require("./view-events-prompt.cjs");
7
+ Object.defineProperty(exports, "VIEW_EVENTS_PROMPT", { enumerable: true, get: function () { return view_events_prompt_js_1.VIEW_EVENTS_PROMPT; } });
@@ -0,0 +1,2 @@
1
+ export { CREATE_EVENT_PROMPT } from "./create-event-prompt.js";
2
+ export { VIEW_EVENTS_PROMPT } from "./view-events-prompt.js";
@@ -0,0 +1,2 @@
1
+ export { CREATE_EVENT_PROMPT } from "./create-event-prompt.js";
2
+ export { VIEW_EVENTS_PROMPT } from "./view-events-prompt.js";
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.VIEW_EVENTS_PROMPT = void 0;
4
+ exports.VIEW_EVENTS_PROMPT = `
5
+ Date format: YYYY-MM-DDThh:mm:ss+00:00
6
+ Based on this event description: 'View my events on Thursday',
7
+ output a json of the following parameters:
8
+ Today's datetime on UTC time 2023-05-02T10:00:00+00:00, it's Tuesday and timezone
9
+ of the user is -5, take into account the timezone of the user and today's date.
10
+ If the user is searching for events with a specific title, person or location, put it into the search_query parameter.
11
+ 1. time_min
12
+ 2. time_max
13
+ 3. user_timezone
14
+ 4. max_results
15
+ 5. search_query
16
+ event_summary:
17
+ {{
18
+ "time_min": "2023-05-04T00:00:00-05:00",
19
+ "time_max": "2023-05-04T23:59:59-05:00",
20
+ "user_timezone": "America/New_York",
21
+ "max_results": 10,
22
+ "search_query": ""
23
+ }}
24
+
25
+ Date format: YYYY-MM-DDThh:mm:ss+00:00
26
+ Based on this event description: '{query}', output a json of the
27
+ following parameters:
28
+ Today's datetime on UTC time {date}, today it's {dayName} and timezone of the user {u_timezone},
29
+ take into account the timezone of the user and today's date.
30
+ If the user is searching for events with a specific title, person or location, put it into the search_query parameter.
31
+ 1. time_min
32
+ 2. time_max
33
+ 3. user_timezone
34
+ 4. max_results
35
+ 5. search_query
36
+ event_summary:
37
+ `;
@@ -0,0 +1 @@
1
+ export declare const VIEW_EVENTS_PROMPT = "\nDate format: YYYY-MM-DDThh:mm:ss+00:00\nBased on this event description: 'View my events on Thursday',\noutput a json of the following parameters: \nToday's datetime on UTC time 2023-05-02T10:00:00+00:00, it's Tuesday and timezone\nof the user is -5, take into account the timezone of the user and today's date.\nIf the user is searching for events with a specific title, person or location, put it into the search_query parameter.\n1. time_min \n2. time_max\n3. user_timezone\n4. max_results \n5. search_query \nevent_summary:\n{{\n \"time_min\": \"2023-05-04T00:00:00-05:00\",\n \"time_max\": \"2023-05-04T23:59:59-05:00\",\n \"user_timezone\": \"America/New_York\",\n \"max_results\": 10,\n \"search_query\": \"\"\n}}\n\nDate format: YYYY-MM-DDThh:mm:ss+00:00\nBased on this event description: '{query}', output a json of the\nfollowing parameters: \nToday's datetime on UTC time {date}, today it's {dayName} and timezone of the user {u_timezone},\ntake into account the timezone of the user and today's date.\nIf the user is searching for events with a specific title, person or location, put it into the search_query parameter.\n1. time_min \n2. time_max\n3. user_timezone\n4. max_results \n5. search_query \nevent_summary:\n";
@@ -0,0 +1,34 @@
1
+ export const VIEW_EVENTS_PROMPT = `
2
+ Date format: YYYY-MM-DDThh:mm:ss+00:00
3
+ Based on this event description: 'View my events on Thursday',
4
+ output a json of the following parameters:
5
+ Today's datetime on UTC time 2023-05-02T10:00:00+00:00, it's Tuesday and timezone
6
+ of the user is -5, take into account the timezone of the user and today's date.
7
+ If the user is searching for events with a specific title, person or location, put it into the search_query parameter.
8
+ 1. time_min
9
+ 2. time_max
10
+ 3. user_timezone
11
+ 4. max_results
12
+ 5. search_query
13
+ event_summary:
14
+ {{
15
+ "time_min": "2023-05-04T00:00:00-05:00",
16
+ "time_max": "2023-05-04T23:59:59-05:00",
17
+ "user_timezone": "America/New_York",
18
+ "max_results": 10,
19
+ "search_query": ""
20
+ }}
21
+
22
+ Date format: YYYY-MM-DDThh:mm:ss+00:00
23
+ Based on this event description: '{query}', output a json of the
24
+ following parameters:
25
+ Today's datetime on UTC time {date}, today it's {dayName} and timezone of the user {u_timezone},
26
+ take into account the timezone of the user and today's date.
27
+ If the user is searching for events with a specific title, person or location, put it into the search_query parameter.
28
+ 1. time_min
29
+ 2. time_max
30
+ 3. user_timezone
31
+ 4. max_results
32
+ 5. search_query
33
+ event_summary:
34
+ `;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getTimezoneOffsetInHours = void 0;
4
+ const getTimezoneOffsetInHours = () => {
5
+ const offsetInMinutes = new Date().getTimezoneOffset();
6
+ const offsetInHours = -offsetInMinutes / 60;
7
+ return offsetInHours;
8
+ };
9
+ exports.getTimezoneOffsetInHours = getTimezoneOffsetInHours;
@@ -0,0 +1,2 @@
1
+ declare const getTimezoneOffsetInHours: () => number;
2
+ export { getTimezoneOffsetInHours };
@@ -0,0 +1,6 @@
1
+ const getTimezoneOffsetInHours = () => {
2
+ const offsetInMinutes = new Date().getTimezoneOffset();
3
+ const offsetInHours = -offsetInMinutes / 60;
4
+ return offsetInHours;
5
+ };
6
+ export { getTimezoneOffsetInHours };
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GoogleCalendarViewTool = void 0;
4
+ const base_js_1 = require("./base.cjs");
5
+ const descriptions_js_1 = require("./descriptions.cjs");
6
+ const run_view_events_js_1 = require("./commands/run-view-events.cjs");
7
+ class GoogleCalendarViewTool extends base_js_1.GoogleCalendarBase {
8
+ constructor(fields) {
9
+ super(fields);
10
+ Object.defineProperty(this, "name", {
11
+ enumerable: true,
12
+ configurable: true,
13
+ writable: true,
14
+ value: "google_calendar_view"
15
+ });
16
+ Object.defineProperty(this, "description", {
17
+ enumerable: true,
18
+ configurable: true,
19
+ writable: true,
20
+ value: descriptions_js_1.VIEW_TOOL_DESCRIPTION
21
+ });
22
+ }
23
+ async _call(query, runManager) {
24
+ const auth = await this.getAuth();
25
+ const model = this.getModel();
26
+ return (0, run_view_events_js_1.runViewEvents)(query, {
27
+ auth,
28
+ model,
29
+ calendarId: this.calendarId,
30
+ }, runManager);
31
+ }
32
+ }
33
+ exports.GoogleCalendarViewTool = GoogleCalendarViewTool;
@@ -0,0 +1,8 @@
1
+ import { GoogleCalendarBase, GoogleCalendarAgentParams } from "./base.js";
2
+ import { CallbackManagerForToolRun } from "../../callbacks/manager.js";
3
+ export declare class GoogleCalendarViewTool extends GoogleCalendarBase {
4
+ name: string;
5
+ description: string;
6
+ constructor(fields: GoogleCalendarAgentParams);
7
+ _call(query: string, runManager?: CallbackManagerForToolRun): Promise<string>;
8
+ }
@@ -0,0 +1,29 @@
1
+ import { GoogleCalendarBase } from "./base.js";
2
+ import { VIEW_TOOL_DESCRIPTION } from "./descriptions.js";
3
+ import { runViewEvents } from "./commands/run-view-events.js";
4
+ export class GoogleCalendarViewTool extends GoogleCalendarBase {
5
+ constructor(fields) {
6
+ super(fields);
7
+ Object.defineProperty(this, "name", {
8
+ enumerable: true,
9
+ configurable: true,
10
+ writable: true,
11
+ value: "google_calendar_view"
12
+ });
13
+ Object.defineProperty(this, "description", {
14
+ enumerable: true,
15
+ configurable: true,
16
+ writable: true,
17
+ value: VIEW_TOOL_DESCRIPTION
18
+ });
19
+ }
20
+ async _call(query, runManager) {
21
+ const auth = await this.getAuth();
22
+ const model = this.getModel();
23
+ return runViewEvents(query, {
24
+ auth,
25
+ model,
26
+ calendarId: this.calendarId,
27
+ }, runManager);
28
+ }
29
+ }