Zack Zhiyuan Li
commited on
Commit
•
2727916
1
Parent(s):
140dfaa
add data example
Browse files- README.md +23 -1
- android_functions.txt +254 -0
README.md
CHANGED
@@ -34,6 +34,8 @@ Octopus-V2-2B, an advanced open-source language model with 2 billion parameters,
|
|
34 |
💪 **Function Calling Capabilities**: Octopus-V2-2B is capable of generating individual, nested, and parallel function calls across a variety of complex scenarios.
|
35 |
|
36 |
## Example Use Cases
|
|
|
|
|
37 |
<p align="center" width="100%">
|
38 |
<a><img src="tool-usage-compressed.png" alt="ondevice" style="width: 80%; min-width: 300px; display: block; margin: auto;"></a>
|
39 |
</p>
|
@@ -77,6 +79,26 @@ print("latency:", time.time() - start_time," s")
|
|
77 |
<a><img src="accuracy_plot.jpg" alt="ondevice" style="width: 80%; min-width: 300px; display: block; margin: auto;"></a>
|
78 |
</p>
|
79 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
80 |
## License
|
81 |
This model was trained on commercially viable data and is under the [Nexa AI community disclaimer](https://www.nexa4ai.com/disclaimer).
|
82 |
|
@@ -105,4 +127,4 @@ We thank the Google Gemma team for their amazing models!
|
|
105 |
```
|
106 |
|
107 |
## Contact
|
108 |
-
Please [contact us](
|
|
|
34 |
💪 **Function Calling Capabilities**: Octopus-V2-2B is capable of generating individual, nested, and parallel function calls across a variety of complex scenarios.
|
35 |
|
36 |
## Example Use Cases
|
37 |
+
|
38 |
+
|
39 |
<p align="center" width="100%">
|
40 |
<a><img src="tool-usage-compressed.png" alt="ondevice" style="width: 80%; min-width: 300px; display: block; margin: auto;"></a>
|
41 |
</p>
|
|
|
79 |
<a><img src="accuracy_plot.jpg" alt="ondevice" style="width: 80%; min-width: 300px; display: block; margin: auto;"></a>
|
80 |
</p>
|
81 |
|
82 |
+
|
83 |
+
## Training Data
|
84 |
+
We wrote 20 Android API descriptions to used to train the models, see [this file](android_functions.txt) for details. The Android API implementations for our demos, and our training data will be published later. Below is one Android API description example
|
85 |
+
```
|
86 |
+
def get_trending_news(category=None, region='US', language='en', max_results=5):
|
87 |
+
"""
|
88 |
+
Fetches trending news articles based on category, region, and language.
|
89 |
+
|
90 |
+
Parameters:
|
91 |
+
- category (str, optional): News category to filter by, by default use None for all categories. Optional to provide.
|
92 |
+
- region (str, optional): ISO 3166-1 alpha-2 country code for region-specific news, by default, uses 'US'. Optional to provide.
|
93 |
+
- language (str, optional): ISO 639-1 language code for article language, by default uses 'en'. Optional to provide.
|
94 |
+
- max_results (int, optional): Maximum number of articles to return, by default, uses 5. Optional to provide.
|
95 |
+
|
96 |
+
Returns:
|
97 |
+
- list[str]: A list of strings, each representing an article. Each string contains the article's heading and URL.
|
98 |
+
"""
|
99 |
+
```
|
100 |
+
|
101 |
+
|
102 |
## License
|
103 |
This model was trained on commercially viable data and is under the [Nexa AI community disclaimer](https://www.nexa4ai.com/disclaimer).
|
104 |
|
|
|
127 |
```
|
128 |
|
129 |
## Contact
|
130 |
+
Please [contact us](mailto:alexchen@nexa4ai.com) to reach out for any issues and comments!
|
android_functions.txt
ADDED
@@ -0,0 +1,254 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
def take_a_photo(camera="back", resolution="1080p"):
|
2 |
+
"""
|
3 |
+
Captures a photo using the specified camera and resolution settings.
|
4 |
+
|
5 |
+
Parameters:
|
6 |
+
- camera (str, optional): Specifies the camera to use. Can be 'front' or 'back'. The default is 'back'. Optional to provide.
|
7 |
+
- resolution (str, optional): Sets the photo resolution. Options include '720p', '1080p', and '4K'. The default is '1080p'. Optional to provide.
|
8 |
+
|
9 |
+
Returns:
|
10 |
+
- str: The string contains the file path of the captured photo if successful, or an error message if not. Example: '/storage/emulated/0/Pictures/MyApp/IMG_20240310_123456.jpg'
|
11 |
+
"""
|
12 |
+
|
13 |
+
|
14 |
+
def get_trending_news(category=None, region='US', language='en', max_results=5):
|
15 |
+
"""
|
16 |
+
Fetches trending news articles based on category, region, and language.
|
17 |
+
|
18 |
+
Parameters:
|
19 |
+
- category (str, optional): News category to filter by, by default use None for all categories. Optional to provide.
|
20 |
+
- region (str, optional): ISO 3166-1 alpha-2 country code for region-specific news, by default, uses 'US'. Optional to provide.
|
21 |
+
- language (str, optional): ISO 639-1 language code for article language, by default uses 'en'. Optional to provide.
|
22 |
+
- max_results (int, optional): Maximum number of articles to return, by default, uses 5. Optional to provide.
|
23 |
+
|
24 |
+
Returns:
|
25 |
+
- list[str]: A list of strings, each representing an article. Each string contains the article's heading and URL.
|
26 |
+
"""
|
27 |
+
|
28 |
+
|
29 |
+
def get_weather_forecast(location, days=1):
|
30 |
+
"""
|
31 |
+
Provides a weather forecast for a specified location over a given number of days. Each day's forecast includes a brief description of the expected weather conditions.
|
32 |
+
|
33 |
+
Parameters:
|
34 |
+
- location (str): The location for which the weather forecast is desired. Can be a city name, ZIP code, or other location identifiers.
|
35 |
+
- days (int, optional): The number of days to include in the forecast, starting from today. The default is 1 day. Optional to provide.
|
36 |
+
|
37 |
+
Returns:
|
38 |
+
- list[str]: A list of strings, each representing the weather forecast for one day. Each string includes the date and a brief description of the weather conditions. Formatted in 'YYYY-MM-DD: Description' format.
|
39 |
+
"""
|
40 |
+
|
41 |
+
|
42 |
+
def send_email(recipient, subject, body, attachments=None, cc=None, bcc=None):
|
43 |
+
"""
|
44 |
+
Sends an email with optional attachments, CC, and BCC.
|
45 |
+
|
46 |
+
Parameters:
|
47 |
+
- recipient (str): Primary recipient's email address.
|
48 |
+
- subject (str): Email subject line.
|
49 |
+
- body (str): Main email body content.
|
50 |
+
- attachments (list of str, optional): A list of file paths representing files to attach to the email. Defaults to None, indicating no attachments. Optional to provide.
|
51 |
+
- cc (list of str, optional): A list of email addresses to include in the Carbon Copy (CC) field. Defaults to None. Optional to provide.
|
52 |
+
- bcc (list of str, optional): A list of email addresses to include in the Blind Carbon Copy (BCC) field. Defaults to None. Optional to provide.
|
53 |
+
|
54 |
+
Returns:
|
55 |
+
"""
|
56 |
+
|
57 |
+
|
58 |
+
def search_youtube_videos(query, max_results=10, search_filter="Relevance"):
|
59 |
+
"""
|
60 |
+
Searches YouTube for videos matching a query.
|
61 |
+
|
62 |
+
Parameters:
|
63 |
+
- query (str): Search query.
|
64 |
+
- max_results (int, optional): Maximum number of search results, by default, use 10. Optional to provide.
|
65 |
+
- search_filter (enum, optional): Filter for search results, chosen from 'Relevance', 'Upload date', 'View Count', 'Rating'. By default, use 'Relevance'. Optional to provide.
|
66 |
+
|
67 |
+
Returns:
|
68 |
+
- list[str]: A list of strings, each string includes video names and URLs.
|
69 |
+
"""
|
70 |
+
|
71 |
+
|
72 |
+
def find_route_google_maps(origin, destination, mode="driving"):
|
73 |
+
"""
|
74 |
+
Computes a route using Google Maps from an origin to a destination.
|
75 |
+
|
76 |
+
Parameters:
|
77 |
+
- origin (str): Starting location.
|
78 |
+
- destination (str): Target location.
|
79 |
+
- mode (enum, optional): Mode of transportation, options include 'driving', 'walking', 'bicycling', and 'transit'. The default mode is 'driving'. Optional to provide.
|
80 |
+
|
81 |
+
Returns:
|
82 |
+
- List[str]: The string provides the route details.
|
83 |
+
"""
|
84 |
+
|
85 |
+
|
86 |
+
def check_nest_smoke_detector_status():
|
87 |
+
"""
|
88 |
+
Check the current status of a Nest Smoke Detector.
|
89 |
+
|
90 |
+
Parameters:
|
91 |
+
|
92 |
+
Returns:
|
93 |
+
- str: A message with the detailed smoke detector status. This message includes information about battery level, sensor functionality, and connectivity status.
|
94 |
+
"""
|
95 |
+
|
96 |
+
|
97 |
+
def send_text_message(contact_name, message):
|
98 |
+
"""
|
99 |
+
Sends a text message to the specified contact.
|
100 |
+
|
101 |
+
Parameters:
|
102 |
+
- contact_name (str): The name of the recipient contact. This is the identifier used to locate the contact in the messaging service or device's contact list.
|
103 |
+
- message (str): The content of the message to be sent. This is what the recipient will receive.
|
104 |
+
|
105 |
+
Returns:
|
106 |
+
"""
|
107 |
+
|
108 |
+
|
109 |
+
def make_phone_call(phone_number):
|
110 |
+
"""
|
111 |
+
Initiates a phone call to the given phone number. It can handle both international and domestic numbers.
|
112 |
+
|
113 |
+
Parameters:
|
114 |
+
- phone_number (str): The target phone number. For international numbers, use the international format (+country_code national_number). For domestic numbers, use the standard national format without the country code.
|
115 |
+
|
116 |
+
Returns:
|
117 |
+
"""
|
118 |
+
|
119 |
+
|
120 |
+
def create_contact(name, phone_number, email=None, organization=None, notes=None):
|
121 |
+
"""
|
122 |
+
Creates a new contact entry in the device's address book.
|
123 |
+
|
124 |
+
Parameters:
|
125 |
+
- name (str): Full name of the contact.
|
126 |
+
- phone_number (str): Primary phone number of the contact.
|
127 |
+
- email (str, optional): Email address of the contact, default is None, optional to provide.
|
128 |
+
- organization (str, optional): Associated organization name, default is None, optional to provide.
|
129 |
+
- notes (str, optional): Additional notes or comments, default is None, optional to provide.
|
130 |
+
|
131 |
+
Returns:
|
132 |
+
"""
|
133 |
+
|
134 |
+
|
135 |
+
def set_timer_alarm(time, repeat=False, label=None):
|
136 |
+
"""
|
137 |
+
Sets a timer or alarm for a specified time.
|
138 |
+
|
139 |
+
Parameters:
|
140 |
+
- time (str): Alarm time in "HH:MM" 24-hour format. For example, "07:12" for 7:12 AM.
|
141 |
+
- repeat (bool, optional): Whether the alarm should repeat daily, default is False, optional to provide.
|
142 |
+
- label (str, optional): Custom label for the alarm, default is None, optional to provide.
|
143 |
+
|
144 |
+
Returns:
|
145 |
+
"""
|
146 |
+
|
147 |
+
|
148 |
+
def change_screen_brightness(level):
|
149 |
+
"""
|
150 |
+
Adjust the device's screen brightness level.
|
151 |
+
|
152 |
+
Parameters:
|
153 |
+
- level (int): Desired brightness level, on a scale from 0 (minimum) to 10 (maximum).
|
154 |
+
|
155 |
+
Returns:
|
156 |
+
"""
|
157 |
+
|
158 |
+
|
159 |
+
def create_calendar_event(title, start_time, end_time, location=None, description=None):
|
160 |
+
"""
|
161 |
+
Schedules a new event in the calendar.
|
162 |
+
|
163 |
+
Parameters:
|
164 |
+
- title (str): Event title.
|
165 |
+
- start_time (str): Event start time as a string in ISO 8601 format "YYYY-MM-DD-HH-MM". For example, "2022-12-31-23-59" for 11:59 PM on December 31, 2022.
|
166 |
+
- end_time (str): Event end time as a string in ISO 8601 format "YYYY-MM-DD-HH-MM". Must be after start_time. For example, "2023-01-01-00-00" for 12:00 AM on January 1, 2023.
|
167 |
+
- location (str, optional): Location of the event. The default is None, optional to provide.
|
168 |
+
- description (str, optional): Detailed event description. The default is None, optional to provide.
|
169 |
+
|
170 |
+
Returns:
|
171 |
+
"""
|
172 |
+
|
173 |
+
|
174 |
+
def set_volume(level, volume_type = VolumeType.RING):
|
175 |
+
"""
|
176 |
+
Sets the volume level for a specified type (ring, media, alarm).
|
177 |
+
|
178 |
+
Parameters:
|
179 |
+
- level (int): Target volume level, from 0 (mute) to 10 (maximum).
|
180 |
+
- volume_type (enum): The category of volume to adjust, select from VolumeType.RING, VolumeType.MEDIA, VolumeType.ALARM, by default it is VolumeType.RING, optional to provide.
|
181 |
+
|
182 |
+
Returns:
|
183 |
+
"""
|
184 |
+
|
185 |
+
|
186 |
+
def connect_to_bluetooth_device(device_name, timeout=10):
|
187 |
+
"""
|
188 |
+
Attempts to connect to a specified Bluetooth device within a given timeout.
|
189 |
+
|
190 |
+
Parameters:
|
191 |
+
- device_name (str): The name of the Bluetooth device to connect to.
|
192 |
+
- timeout (int, optional): The maximum time, in seconds, to attempt a connection. The default is 10 seconds. Optional to provide.
|
193 |
+
|
194 |
+
Returns:
|
195 |
+
- bool: Returns True if the device was successfully connected within the timeout period, False otherwise.
|
196 |
+
"""
|
197 |
+
|
198 |
+
|
199 |
+
def enable_do_not_disturb(enabled):
|
200 |
+
"""
|
201 |
+
Toggles the Do Not Disturb mode on or off.
|
202 |
+
|
203 |
+
Parameters:
|
204 |
+
- enabled (bool): True to enable, False to disable Do Not Disturb mode.
|
205 |
+
|
206 |
+
Returns:
|
207 |
+
"""
|
208 |
+
|
209 |
+
|
210 |
+
def set_nest_temperature(target_temperature):
|
211 |
+
"""
|
212 |
+
Sets a Nest Thermostat to a desired temperature.
|
213 |
+
|
214 |
+
Parameters:
|
215 |
+
- target_temperature (float): Target temperature in degrees Fahrenheit, ranging from 50 to 90.
|
216 |
+
|
217 |
+
Returns:
|
218 |
+
"""
|
219 |
+
|
220 |
+
|
221 |
+
def play_music_on_nest_hub(music_service, playlist_name):
|
222 |
+
"""
|
223 |
+
Streams music on a Google Nest Audio device from a specified service.
|
224 |
+
|
225 |
+
Parameters:
|
226 |
+
- music_service (str): Music streaming service name.
|
227 |
+
- playlist_name (str): Playlist name to play.
|
228 |
+
|
229 |
+
Returns:
|
230 |
+
"""
|
231 |
+
|
232 |
+
|
233 |
+
def play_video_on_nest_hub(video_service, playlist_name, resolution="2K"):
|
234 |
+
"""
|
235 |
+
Streams video on a Google Nest Hub device from a specified service.
|
236 |
+
|
237 |
+
Parameters:
|
238 |
+
- video_service (str): Video streaming service name.
|
239 |
+
- playlist_name (str): Video playlist name to play.
|
240 |
+
- resolution (enum, optional): Desired video resolution, chosen from '360p', '720p', '1080p', '2K', '4K'. default is '1080p', optional to provide.
|
241 |
+
|
242 |
+
Returns:
|
243 |
+
"""
|
244 |
+
|
245 |
+
|
246 |
+
def open_or_lock_door(status):
|
247 |
+
"""
|
248 |
+
Opens or locks a door using a Google-compatible smart lock.
|
249 |
+
|
250 |
+
Parameters:
|
251 |
+
- status (enum): Desired action, chosen from 'open' or 'lock'.
|
252 |
+
|
253 |
+
Returns:
|
254 |
+
"""
|