### Installation and Setup Source: https://github.com/openpluginaci/openplugin/blob/main/npm-core/openplugincore/README.md Instructions on how to install the 'openplugincore' package and set up the necessary environment variables. ```APIDOC ## Installation Install the `openplugincore` package using npm: ```shell npm install openplugincore ``` ## Setup Environment Variable Set up your `OPENAI_API_KEY` environment variable. Create a `.env` file in your project's root directory and add your OpenAI API key: ```shell OPENAI_API_KEY=your-api-key ``` ``` -------------------------------- ### Install openplugincore Source: https://github.com/openpluginaci/openplugin/blob/main/npm-core/openplugincore/README.md Installs the openplugincore package using npm. This is the first step to using the library in your project. ```shell npm install openplugincore ``` -------------------------------- ### Install openpluginclient Source: https://github.com/openpluginaci/openplugin/blob/main/npm-client/openpluginclient/README.md This command installs the openpluginclient package using npm. It's the first step to using the library in your project. ```shell npm install openpluginclient ``` -------------------------------- ### Install OpenPlugin Core Source: https://github.com/openpluginaci/openplugin/blob/main/pypi-core/README.md Command to install the openplugincore package via pip. ```shell pip install openplugincore ``` -------------------------------- ### GET /welcome Source: https://github.com/openpluginaci/openplugin/blob/main/PLUGINS.md Initializes the interaction with the RecombinantAI plugin and serves as the main menu for the user. ```APIDOC ## GET /welcome ### Description Initiates the user session and displays the main menu for the RecombinantAI IDE. ### Method GET ### Endpoint /welcome ### Response #### Success Response (200) - **message** (string) - Welcome message and menu options. #### Response Example { "message": "Welcome to RecombinantAI. How can I assist you with your code today?" } ``` -------------------------------- ### Basic Usage with openpluginCompletion Source: https://github.com/openpluginaci/openplugin/blob/main/npm-core/openplugincore/README.md Demonstrates the simplest way to use 'openplugincore' to get a completion from a plugin. ```APIDOC ## Basic Usage with openpluginCompletion This example shows how to use the `openpluginCompletion` function for a straightforward plugin interaction. ### Method `openpluginCompletion(prompt, pluginName, pluginUrl, apiKey, options)` ### Parameters - **prompt** (string) - Required - The user's prompt. - **pluginName** (string) - Required - The name of the plugin to use. - **pluginUrl** (string) - Optional - The URL of the plugin. - **apiKey** (string) - Required - Your OpenAI API key. - **options** (object) - Optional - Configuration options for the model. - **model** (string) - The model to use (e.g., "gpt-3.5-turbo-0613"). - **temperature** (number) - Controls randomness. Lower values make output more focused and deterministic. ### Request Example ```js import { openpluginCompletion } from 'openplugincore'; import dotenv from 'dotenv'; dotenv.config(); const completion = await openpluginCompletion( "show me a gif of a gangster cat", "GifApi", undefined, process.env.OPENAI_API_KEY, { model: "gpt-3.5-turbo-0613", temperature: 0, } ); console.log(completion.choices[0]); ``` ### Response Example ```json { "message": { "role": "assistant", "content": "[Plugin response content]" } } ``` ``` -------------------------------- ### Configure Advanced Truncation and Token Management in Python Source: https://context7.com/openpluginaci/openplugin/llms.txt Shows how to use the fetch_plugin method in Python with advanced options for token management. Includes examples for auto-truncation, custom token limits, offsets, and returning assistant messages for multi-turn conversations. ```python from openplugincore import OpenPlugin import os plugin = OpenPlugin("GifApi", openai_api_key=os.environ["OPENAI_API_KEY"]) messages = [{"role": "user", "content": "show me 50 gifs of cats"}] # Auto truncate based on model limits response = plugin.fetch_plugin( model="gpt-3.5-turbo-0613", messages=messages, truncate=True, temperature=0 ) # Custom truncation limit response = plugin.fetch_plugin( model="gpt-3.5-turbo-0613", messages=messages, truncate=2000, temperature=0 ) # Additional offset for token budget response = plugin.fetch_plugin( model="gpt-3.5-turbo-0613", messages=messages, truncate=True, truncate_offset=500, temperature=0 ) # Get assistant message for multi-turn conversations response = plugin.fetch_plugin( model="gpt-3.5-turbo-0613", messages=messages, truncate=True, return_assistant_message=True ) ``` -------------------------------- ### GET /projects Source: https://github.com/openpluginaci/openplugin/blob/main/PLUGINS.md Retrieves a list of all projects associated with the current user. ```APIDOC ## GET /projects ### Description Fetches all projects managed by the user. It is recommended to call this before performing any file or project operations. ### Method GET ### Endpoint /projects ### Response #### Success Response (200) - **projects** (array) - A list of project objects. #### Response Example { "projects": [ {"id": "proj_1", "name": "MyRepo"} ] } ``` -------------------------------- ### Basic openplugincore Usage with openpluginCompletion Source: https://github.com/openpluginaci/openplugin/blob/main/npm-core/openplugincore/README.md Demonstrates the simplest way to use openplugincore by calling the openpluginCompletion function. This function takes a prompt, plugin name, and API key to get a completion, suitable for straightforward interactions. ```javascript import { openpluginCompletion } from 'openplugincore'; import dotenv from 'dotenv'; // to get .env variables dotenv.config(); // to get .env variables const completion = await openpluginCompletion( "show me a gif of a gangster cat", "GifApi", undefined, process.env.OPENAI_API_KEY, { model: "gpt-3.5-turbo-0613", temperature: 0, } ); console.log(completion.choices[0]); ``` -------------------------------- ### GET /api/hello (Career Test) Source: https://github.com/openpluginaci/openplugin/blob/main/PLUGINS.md Finds suitable jobs based on the RIASEC model by providing two personality types. ```APIDOC ## GET /api/hello ### Description Allows users to find the most suitable jobs based on the RIASEC model. Requires two personality types (type1 and type2). ### Method GET ### Endpoint https://mindart.app/api/hello/ ### Parameters #### Query Parameters - **type1** (string) - Required - The first RIASEC personality type (Realistic, Investigative, Artistic, Social, Enterprising, Conventional). - **type2** (string) - Required - The second RIASEC personality type (Realistic, Investigative, Artistic, Social, Enterprising, Conventional). ### Request Example https://mindart.app/api/hello/?type1=realistic&type2=social ### Response #### Success Response (200) - **jobs** (array) - List of suitable job recommendations based on the provided RIASEC types. ``` -------------------------------- ### GET /version Source: https://github.com/openpluginaci/openplugin/blob/main/PLUGINS.md Retrieves the current version of the XWeather API. ```APIDOC ## GET /version ### Description Retrieves the current version of the XWeather API. ### Method GET ### Endpoint /version ### Parameters None ### Request Example ```json {} ``` ### Response #### Success Response (200) - **version** (string) - The current API version. #### Response Example ```json { "version": "1.0.0" } ``` ``` -------------------------------- ### Using OpenPluginMemo for Plugin Management Source: https://github.com/openpluginaci/openplugin/blob/main/npm-core/openplugincore/README.md Explains how to use `OpenPluginMemo` for efficient management and retrieval of plugin instances. ```APIDOC ## Using OpenPluginMemo for Plugin Management The `OpenPluginMemo` class provides a way to manage and cache plugin instances, improving efficiency. ### Initialization ```js import { OpenPluginMemo } from 'openplugincore'; import dotenv from 'dotenv'; dotenv.config(); const openpluginMemo = new OpenPluginMemo() await openpluginMemo.init() ``` ### Initializing and Fetching a Specific Plugin ```js const firstGifPlugin = await openpluginMemo.initPlugin("GifApi") const firstPrompt = "show me a gif of a gangster cat" const firstFunctionRes = await firstGifPlugin.fetchPlugin({ prompt: firstPrompt, model: "gpt-3.5-turbo-0613" }); ``` ### Making a Completion Request (similar to OpenPlugin) ```js const firstCompletionRes = await fetch('https://api.openai.com/v1/chat/completions', { method: 'POST', headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${process.env.OPENAI_API_KEY}`, }, body: JSON.stringify({ model: 'gpt-3.5-turbo-0613', messages: [ {role: 'user', content: firstPrompt}, firstFunctionRes ], temperature: 0, }), }) const firstCompletionResJson = await firstCompletionRes.json() console.log(firstCompletionResJson.choices[0]); ``` ``` -------------------------------- ### GET /files/by_project/{project_id} Source: https://github.com/openpluginaci/openplugin/blob/main/PLUGINS.md Retrieves all files associated with a specific project ID. ```APIDOC ## GET /files/by_project/{project_id} ### Description Lists all files contained within a specific project. ### Method GET ### Endpoint /files/by_project/{project_id} ### Parameters #### Path Parameters - **project_id** (string) - Required - The unique ID of the project. ### Response #### Success Response (200) - **files** (array) - List of file metadata objects. #### Response Example { "files": [ {"file_id": "f_001", "name": "main.py"} ] } ``` -------------------------------- ### GET /msi-eod & /vix-term Source: https://github.com/openpluginaci/openplugin/blob/main/PLUGINS.md Endpoints for retrieving volatility-related data and market sentiment indicators. ```APIDOC ## GET /msi-eod & /vix-term ### Description Endpoints for retrieving volatility-related data and market sentiment indicators. ### Method GET ### Endpoint /msi-eod or /vix-term ### Parameters None ### Response #### Success Response (200) - **data** (object) - Raw calculated volatility data and associated plots. #### Response Example { "plot_url": "https://optionspro.io/plots/vix.png", "data": { "vix_level": 18.5 } } ``` -------------------------------- ### GET /stock-outlook Source: https://github.com/openpluginaci/openplugin/blob/main/PLUGINS.md Allows for individual stock analysis based on a provided ticker symbol. ```APIDOC ## GET /stock-outlook ### Description Allows for individual stock analysis, especially when a specific ticker is provided. ### Method GET ### Endpoint /stock-outlook ### Parameters #### Query Parameters - **ticker** (string) - Required - The stock symbol to analyze (e.g., AAPL). ### Response #### Success Response (200) - **analysis** (object) - Detailed outlook for the requested stock including volatility and flow data. #### Response Example { "ticker": "AAPL", "analysis": "Strong support levels identified at $150." } ``` -------------------------------- ### POST /project Source: https://github.com/openpluginaci/openplugin/blob/main/PLUGINS.md Creates a new cloud project within the RecombinantAI environment. ```APIDOC ## POST /project ### Description Creates a new project record in the system. ### Method POST ### Endpoint /project ### Request Body - **name** (string) - Required - The name of the project to be created. ### Response #### Success Response (200) - **project_id** (string) - The unique identifier for the newly created project. #### Response Example { "project_id": "proj_123456", "status": "created" } ``` -------------------------------- ### Test Fetch and Parse Plugin (Python) Source: https://github.com/openpluginaci/openplugin/blob/main/migrations/plugin_store/classifier.ipynb This Python function tests the fetching and parsing of an OpenPlugin. It initializes an OpenPlugin instance using the provided API key and root URL, then attempts to whitelist the plugin. It logs success or error messages and updates the plugin's whitelisted status. ```python def test_fetch_and_parse(openplugins_info: OpenPluginsInfo, openplugin_classes: Dict[str, OpenPlugin], openai_res_plugin: Any) -> OpenPluginInfoInit: namespace = openai_res_plugin['namespace'] openplugin_info = openplugins_info[namespace] root_url = "https://" + openplugin_info['domain'] try: openplugin_classes[namespace] = OpenPlugin(openai_api_key=OPENAI_API_KEY, root_url=root_url) logging.info(f"{namespace} Whitelist Success") openplugin_info['whitelisted'] = True except Exception as e: logging.error(f"{namespace} Whitelist Error: {e}") openplugin_info['whitelisted'] = False return openplugin_info second = test_fetch_and_parse(openplugins_info, openplugin_classes, openai_res_ex) second ``` -------------------------------- ### GET /maps Source: https://github.com/openpluginaci/openplugin/blob/main/PLUGINS.md Generates a map with a marker based on provided latitude and longitude coordinates. ```APIDOC ## GET /maps ### Description Generates a map with a marker on a specific spot based on latitude and longitude coordinates. ### Method GET ### Endpoint /?latlng={lat},{lng} ### Parameters #### Query Parameters - **latlng** (string) - Required - Coordinates in the format 'latitude,longitude' (e.g., 12.34567,-23.45678) ### Request Example GET /?latlng=12.34567,-23.45678 ### Response #### Success Response (200) - **map_url** (string) - URL to the generated map image. ``` -------------------------------- ### GET /plugins/agones Source: https://github.com/openpluginaci/openplugin/blob/main/PLUGINS.md Retrieve historical and upcoming soccer match results from the Agones plugin. ```APIDOC ## GET /plugins/agones ### Description Retrieves soccer match results based on team names, dates, or specific match types. ### Method GET ### Endpoint /plugins/agones ### Parameters #### Query Parameters - **team1** (string) - Optional - Name of the first team. - **team2** (string) - Optional - Name of the second team. - **date_type** (string) - Required - Type of date range: 'latest', 'next', or 'range'. - **date_from** (string) - Optional - Start date in YYYY-MM-DD format (required for 'range'). - **date_until** (string) - Optional - End date in YYYY-MM-DD format (required for 'range'). ### Response #### Success Response (200) - **results** (array) - List of match objects containing home_team, away_team, match_date, state, score_halftime, and score_current. #### Response Example { "results": [ { "home_team": "Liverpool", "away_team": "Arsenal", "match_date": "2023-05-02", "state": "finished", "score_halftime": "2 - 0", "score_current": "4 - 0" } ] } ``` -------------------------------- ### Manage Plugin Data and Blacklists Source: https://github.com/openpluginaci/openplugin/blob/main/migrations/plugin_store/classifier.ipynb This script demonstrates how to load plugin data from JSON files, maintain a blacklist of plugins, and aggregate items into a list. It includes error handling for JSON parsing and file existence checks. ```python import json import os # Load all plugins all_plugins = 'openai_res.json' with open(all_plugins, 'r', encoding='utf-8') as f: openai_res = json.load(f) # Manage blacklist if os.path.exists('blacklist.json'): with open('blacklist.json', 'r', encoding='utf-8') as f: blacklist = json.load(f) else: blacklist = {} with open('blacklist.json', 'w', encoding='utf-8') as f: json.dump(blacklist, f, indent=2) def aggregate_items(json_object): aggregate_list = [] for key in json_object: aggregate_list.extend(json_object[key]) return aggregate_list blacklist_list = aggregate_items(blacklist) ``` -------------------------------- ### Python: Direct Plugin Control with OpenPlugin Class Source: https://context7.com/openpluginaci/openplugin/llms.txt The `OpenPlugin` class provides granular control over plugin interactions. It initializes plugins by fetching their manifests and converting OpenAPI specifications into callable functions. Use `fetch_plugin` to execute plugin API calls and obtain function messages for ChatGPT summarization. ```python import os import json import openai from openplugincore import OpenPlugin # Initialize OpenAI openai.api_key = os.environ["OPENAI_API_KEY"] # Create plugin instance by name (fetches manifest automatically) plugin = OpenPlugin("GifApi", openai_api_key=os.environ["OPENAI_API_KEY"]) # Or initialize by root URL for custom/unlisted plugins # plugin = OpenPlugin(root_url="https://api.example.com", openai_api_key=os.environ["OPENAI_API_KEY"]) # Prepare messages messages = [ {"role": "user", "content": "show me a gif of a gangster cat"} ] # Fetch plugin response (calls the plugin API) function_response = plugin.fetch_plugin( model="gpt-3.5-turbo-0613", messages=messages, truncate=True, # Auto-truncate to fit model token limits temperature=0 ) # function_response is a ChatGPT function message: # {"role": "function", "name": "searchGifs", "content": "{...api response...}"} # Get final response by passing function result to ChatGPT final_response = openai.ChatCompletion.create( model="gpt-3.5-turbo-0613", messages=messages + [function_response], temperature=0 ) print(json.dumps(final_response, indent=2)) ``` -------------------------------- ### GET /market-outlook Source: https://github.com/openpluginaci/openplugin/blob/main/PLUGINS.md Provides a quick overview of the general market trend based on key indicators. ```APIDOC ## GET /market-outlook ### Description Provides a quick overview of the general market trend based on key indicators. ### Method GET ### Endpoint /market-outlook ### Parameters None ### Response #### Success Response (200) - **indicators** (array) - List of market indicators including description, plot URL, and analysis. #### Response Example { "indicators": [ { "description": "Market Trend Analysis", "plot_url": "https://optionspro.io/plots/market.png", "analysis": "The market is currently showing bullish momentum." } ] } ``` -------------------------------- ### GET /metar Source: https://github.com/openpluginaci/openplugin/blob/main/PLUGINS.md Retrieves current weather data for airports using METAR aviation feeds. ```APIDOC ## GET /metar ### Description Fetches current weather information for a specific airport using its ICAO code. ### Method GET ### Endpoint /metar?icao={icao_code} ### Parameters #### Query Parameters - **icao** (string) - Required - The ICAO code for the airport. ### Response #### Success Response (200) - **weather_data** (object) - Current METAR weather report details. ``` -------------------------------- ### Generate Plugin Completion Source: https://github.com/openpluginaci/openplugin/blob/main/pypi-core/README.md Demonstrates the simplest method to generate a response using a specific plugin via openplugin_completion. ```python from openplugincore import openplugin_completion import os import json openplugin_completion_generation = openplugin_completion( openai_api_key = os.environ["OPENAI_API_KEY"], plugin_name = "GifApi", truncate = True, messages = [ { "role": "user", "content": "show me a gif of a gangster cat" } ], model = "gpt-3.5-turbo-0613", temperature = 0, ) print(json.dumps(openplugin_completion_generation, indent=2)) ``` -------------------------------- ### GET /radar/{location} Source: https://github.com/openpluginaci/openplugin/blob/main/PLUGINS.md Retrieves a weather radar image in Markdown format for the specified location. ```APIDOC ## GET /radar/{location} ### Description Retrieves a weather radar image in Markdown format for the specified location. ### Method GET ### Endpoint /radar/{ "location": "string" } ### Parameters #### Path Parameters - **location** (string) - Required - The location for which to retrieve the radar image. Valid formats include 'city name, state', 'city name, country', 'latitude, longitude', 'zip code', or 'airport code'. ### Request Example ```json { "location": "Chicago, IL" } ``` ### Response #### Success Response (200) - **radarImage** (string) - The weather radar image in Markdown format. #### Response Example ```markdown ![Weather Radar](https://example.com/radar_image.png) ``` ``` -------------------------------- ### Fetch and Execute Plugin Source: https://github.com/openpluginaci/openplugin/blob/main/pypi-core/README.md Shows a nuanced approach to fetching plugin data and manually integrating it with the OpenAI ChatCompletion API. ```python from openplugincore import OpenPlugin import os import json import openai plugin = OpenPlugin("GifApi", os.environ["OPENAI_API_KEY"]) messages = [ { "role": "user", "content": "show me a gif of a gangster cat" } ] function_response = plugin.fetch_plugin( model="gpt-3.5-turbo-0613", messages = messages, truncate = True, temperature=0, ) openai.api_key = os.environ["OPENAI_API_KEY"] OpenPlugin_generation = openai.ChatCompletion.create( model="gpt-3.5-turbo-0613", messages= messages + [function_response], temperature = 0 ) print(json.dumps(OpenPlugin_generation, indent=2)) ``` -------------------------------- ### Generate PLUGINS.md File from Plugin Info (Python) Source: https://github.com/openpluginaci/openplugin/blob/main/migrations/plugin_store/classifier.ipynb Generates a 'PLUGINS.md' file summarizing supported and tentative plugins. It formats plugin details including image, namespace, status, and descriptions, escaping markdown special characters. ```python import os import re from typing import Any, Dict, List # Assuming OpenPluginsInfo and OpenPluginInfo are defined elsewhere # For demonstration, let's define placeholder types if they are not provided class OpenPluginsInfo(dict): pass class OpenPluginInfo(dict): pass def save_to_pluginsmd(openplugins_info: OpenPluginsInfo) -> None: current_dir = os.getcwd() root_dir = os.path.abspath(os.path.join(current_dir, os.pardir, os.pardir)) # Create the file path for plugins.md pluginsmd_path = os.path.join(root_dir, 'PLUGINS.md') plugins_md = """# Plugins Available plugins for OpenPlugin Status: - `tentative`: passed basic tests (may work) - `supported`: passed complete prompt tests (should work) | Image | Namespace | Status | Description | Description for model | | --- | --- | --- | --- | --- | """ def escape_special_markdown_chars(text): # Characters to escape: \ ` * _ { } [ ] ( ) # + ! special_chars = r'\\|`|\*|_|{|}|\[|\]|\(|\)|#|\+|!' return re.sub(special_chars, lambda match: '\\' + match.group(), text) def remove_line_breaks(text): return text.replace('\n', ' ').replace('\r', '') # create two lists of plugins one supported_plugins and one tentative_plugins supported_plugins = [] tentative_plugins = [] for _namespace, openplugin_info in openplugins_info.items(): if openplugin_info["status"] == "tentative": tentative_plugins.append(openplugin_info) if openplugin_info["status"] == "supported": supported_plugins.append(openplugin_info) # now sort the lists by their namespace keys considering that each plugin is a dict of {namespace: str, ...} supported_plugins.sort(key=lambda x: x["namespace"]) tentative_plugins.sort(key=lambda x: x["namespace"]) # aggragate the lists so that supported_plugins is first and tentative_plugins is second ordered_openplugins_info = supported_plugins + tentative_plugins for openplugin_info in ordered_openplugins_info: if openplugin_info["image"]: image = escape_special_markdown_chars(openplugin_info["image"]) else: image = escape_special_markdown_chars("https://i.imgur.com/L3giCRt.png") namespace = escape_special_markdown_chars(openplugin_info["namespace"]) status = escape_special_markdown_chars(openplugin_info["status"]) description = escape_special_markdown_chars(remove_line_breaks(remove_line_breaks(openplugin_info["description_for_human"]))) description_for_model = escape_special_markdown_chars(remove_line_breaks(openplugin_info["description_for_model"])) plugins_md += f"| ![$\{namespace} Logo]($\{image}) | $\{namespace} | $\{status} | $\{description} | $\{description_for_model} |\n" with open(pluginsmd_path, 'w', encoding='utf-8') as f: f.write(plugins_md) # Example usage (assuming openplugins_info is defined) # sixth = save_to_pluginsmd(openplugins_info) # sixth ``` -------------------------------- ### Python: Simple One-Call Plugin Integration with openplugin_completion Source: https://context7.com/openpluginaci/openplugin/llms.txt The `openplugin_completion` function offers a straightforward method for integrating ChatGPT plugins. It handles initialization, function calling, API execution, and response summarization in a single call. It defaults to standard ChatGPT completion if the query does not match any plugin functions. ```python import os import json from openplugincore import openplugin_completion # Simple one-call plugin completion result = openplugin_completion( openai_api_key=os.environ["OPENAI_API_KEY"], plugin_name="GifApi", # Plugin namespace from PLUGINS.md truncate=True, # Truncate API response to fit token limits messages=[ { "role": "user", "content": "show me a gif of a gangster cat" } ], model="gpt-3.5-turbo-0613", temperature=0 ) print(json.dumps(result, indent=2)) # Output: # { # "id": "chatcmpl-", # "choices": [{ # "message": { # "role": "assistant", # "content": "Here's a gif of a gangster cat: https://media.giphy.com/..." # } # }] # } ``` -------------------------------- ### Get Event by Brand Name Source: https://github.com/openpluginaci/openplugin/blob/main/PLUGINS.md Retrieves promotional events related to a specific brand in the MomentX department store. ```APIDOC ## GET /GetEventByBrand/{name} ### Description Retrieves promotional events related to a specific brand in the MomentX department store. ### Method GET ### Endpoint /GetEventByBrand/{ "name": "string" } ### Parameters #### Path Parameters - **name** (string) - Required - The name of the brand to retrieve events for. ### Response #### Success Response (200) - **brandName** (string) - The name of the brand. - **events** (array) - A list of promotional events for the brand. - **eventId** (string) - Unique identifier for the event. - **title** (string) - Title of the event. - **description** (string) - Description of the event. - **startDate** (string) - The start date of the event (ISO 8601 format). - **endDate** (string) - The end date of the event (ISO 8601 format). #### Response Example { "brandName": "Tech Gadgets", "events": [ { "eventId": "event456", "title": "Product Launch", "description": "Newest smartphone launch event", "startDate": "2023-11-10T10:00:00Z", "endDate": "2023-11-10T18:00:00Z" } ] } ``` -------------------------------- ### Get Toilet Info by Area Source: https://github.com/openpluginaci/openplugin/blob/main/PLUGINS.md Returns the detailed location of toilets based on the provided floor number and area. ```APIDOC ## GET /GetToiletInfoByArea/{floor}/{area} ### Description Returns the detailed location of the toilets based on the provided floor number and area. ### Method GET ### Endpoint /GetToiletInfoByArea/{ "floor": "integer", "area": "string" } ### Parameters #### Path Parameters - **floor** (integer) - Required - The floor number. - **area** (string) - Required - The area on the floor. ### Response #### Success Response (200) - **floor** (integer) - The floor number. - **area** (string) - The area on the floor. - **locations** (array) - A list of toilet locations within the specified area. - **description** (string) - Description of the toilet location (e.g., 'Near Entrance A'). - **coordinates** (object) - GPS coordinates of the toilet location. - **latitude** (number) - Latitude. - **longitude** (number) - Longitude. #### Response Example { "floor": 2, "area": "East Wing", "locations": [ { "description": "Next to the food court", "coordinates": { "latitude": 34.0522, "longitude": -118.2437 } } ] } ``` -------------------------------- ### Using OpenPluginMemo for API Call Optimization Source: https://github.com/openpluginaci/openplugin/blob/main/npm-core/openplugincore/README.md Illustrates how to use the OpenPluginMemo class to manage and potentially cache plugin interactions. This approach is useful for respecting plugin API rate limits and optimizing repeated calls. ```javascript import { OpenPluginMemo } from 'openplugincore'; import dotenv from 'dotenv'; dotenv.config(); const openpluginMemo = new OpenPluginMemo() await openpluginMemo.init() const firstGifPlugin = await openpluginMemo.initPlugin("GifApi") // same as OpenPlugin const firstPrompt = "show me a gif of a gangster cat" const firstFunctionRes = await firstGifPlugin.fetchPlugin({ prompt: firstPrompt, model: "gpt-3.5-turbo-0613" }); const firstCompletionRes = await fetch('https://api.openai.com/v1/chat/completions', { method: 'POST', headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${process.env.OPENAI_API_KEY}`, }, body: JSON.stringify({ model: 'gpt-3.5-turbo-0613', messages: [ {role: 'user', content: firstPrompt}, firstFunctionRes ], temperature: 0, }), }) const firstCompletionResJson = await firstCompletionRes.json() console.log(firstCompletionResJson.choices[0]); // finish same as OpenPlugin ``` -------------------------------- ### Execute Plugin Completion with JavaScript Client Source: https://context7.com/openpluginaci/openplugin/llms.txt Demonstrates how to perform a plugin completion request using the openpluginclient library. This approach is suitable for frontend applications or serverless environments where direct access to plugin functionality is required. ```javascript import { openpluginCompletion } from 'openpluginclient'; const completion = await openpluginCompletion({ earlyAccessToken: "__extra__-c22a34e2-89a8-48b2-8474-c664b577526b", pluginName: "ByByAI", model: "gpt-3.5-turbo-0613", messages: [ { role: "user", content: "Show me the best Amazon products for puzzles" } ], temperature: 0, failSilently: false }); console.log(completion); ```