Spaces:
Runtime error
Runtime error
File size: 6,706 Bytes
2d144e4 31a8d29 2d144e4 31a8d29 2d144e4 31a8d29 2d144e4 31a8d29 2d144e4 31a8d29 2d144e4 31a8d29 2d144e4 31a8d29 2d144e4 31a8d29 2d144e4 31a8d29 2d144e4 31a8d29 2d144e4 31a8d29 2d144e4 31a8d29 2d144e4 31a8d29 2d144e4 31a8d29 2d144e4 31a8d29 2d144e4 31a8d29 2d144e4 31a8d29 2d144e4 f750b58 31a8d29 2d144e4 31a8d29 2d144e4 31a8d29 2d144e4 31a8d29 2d144e4 31a8d29 2d144e4 31a8d29 2d144e4 31a8d29 2d144e4 31a8d29 2d144e4 31a8d29 2d144e4 31a8d29 2d144e4 31a8d29 2d144e4 31a8d29 2d144e4 31a8d29 2d144e4 31a8d29 2d144e4 31a8d29 2d144e4 31a8d29 2d144e4 31a8d29 2d144e4 31a8d29 2d144e4 31a8d29 2d144e4 31a8d29 2d144e4 31a8d29 2d144e4 31a8d29 2d144e4 31a8d29 2d144e4 31a8d29 ca3ee35 31a8d29 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 |
# Creating a Prompt and Chain with the transcription so it can be passed to the official Command Prompt via
# Simple Sequential chain Transcription template
prompt_transcribe = """You are to pass the audio transcription to the next
chain. Do not alter the transcription in any way.
Transcription: {text}
"""
# Prompt template
prompt_command = """You are in control of an Unmanned Aerial Vehicle or UAV.
You are going to be given a sentence command, you need to find the action of
the sentence. The action will be, "TAKEPICTURE" (Take picture), "TAKEOFF" (Take off), "LAND" (Land) or "GOTO" (Go to).
If the action is not one of those actions return "NONE".
If the action is "TAKEOFF" (Take off), "LAND" (Land), or "NONE" you don't need any further information for the location.
If the action is "GOTO" (Go to) or "TAKEPICTURE" (Take picture), you'll need to find where to carry out the action.
If the action is "GOTO" (Go to) or "TAKEPICTURE" (Take picture) with no location following it, return "NONE".
If you can't find the actions "TAKEPICTURE" (Take picture), "TAKEOFF" (Take off), "LAND" (Land), or "GOTO" (Go to), return "NONE".
You need to return the command in this format: <command> \t<goal>
However, if you get a sentence with multiple commands here is what you need to do:
For example take the sentence, "Go to the Walmart in Petersburg and take a picture."
The format of the command needs to be: <first command> \t<goal>\n\n<second command> \t<goal>
Sentence: {sentence}
"""
prompt_chat_response = """You are an AI-powered chatbot integrated into a UAV
(Unmanned Aerial Vehicle) system. Your purpose is to receive and execute
commands from an officer. Your role is to understand and carry out these commands
efficiently. You must acknowledge the command if you understand it. Use 2-3
sentences to respond to the officer's instructions, ask for clarification if
needed, and provide updates on the execution status of the given commands.
"""
# Creating examples for each command that the llm can use to help format our commands.
# Also passing the transcription to the Command Prompt Template.
examples_few_shot = [
# Location only
{
"sentence": "Kroger on N Lombardy St.",
"command": "GOTO \tKroger on N Lombardy St"
},
{
"sentence": "CVS at Main St.",
"command": "GOTO \tCVS at Main St"
},
{
"sentence": "Short Pump Town Center.",
"command": "GOTO \tShort Pump Town Center"
},
{
"sentence": "Can Can Brasserie.",
"command": "GOTO \tCan Can Brasserie"
},
{
"sentence": "Walgreens.",
"command": "GOTO \tWalgreens"
},
{
"sentence": "Best Buy in Colonial Heights.",
"command": "GOTO \tBest Buy in Colonial Heights"
},
{
"sentence": "The red house to the left.",
"command": "GOTO \tred house to the left"
},
{
"sentence": "The Science Museum.",
"command": "GOTO \tScience Museum"
},
{
"sentence": "South Park Mall.",
"command": "GOTO \tSouth Park Mall"
},
# Commands that don't require a location
{
"sentence": "Take off now.",
"command": "TAKEOFF"
},
{
"sentence": "Take off from where you are.",
"command": "TAKEOFF"
},
{
"sentence": "Take off.",
"command": "TAKEOFF"
},
{
"sentence": "Take off at your position.",
"command": "TAKEOFF"
},
{
"sentence": "Take off from where you are at.",
"command": "TAKEOFF"
},
{
"sentence": "Lift off.",
"command": "TAKEOFF"
},
{
"sentence": "Land.",
"command": "LAND"
},
{
"sentence": "Cease flight.",
"command": "LAND"
},
{
"sentence": "Stop the flight.",
"command": "LAND"
},
{
"sentence": "Stop flying.",
"command": "LAND"
},
{
"sentence": "Take flight.",
"command": "TAKEOFF"
},
# Commands that require a location but don't have any
{
"sentence": "Take a pic.",
"command": "NONE"
},
{
"sentence": "Take a photo.",
"command": "NONE"
},
{
"sentence": "Snap a photo.",
"command": "NONE"
},
{
"sentence": "Snap a pic.",
"command": "NONE"
},
{
"sentence": "Proceed to.",
"command": "NONE"
},
{
"sentence": "Push to.",
"command": "NONE"
},
{
"sentence": "Advance to.",
"command": "NONE"
},
{
"sentence": "Make your way to.",
"command": "NONE"
},
{
"sentence": "Travel to.",
"command": "NONE"
},
{
"sentence": "Go to.",
"command": "NONE"
},
{
"sentence": "Take a picture.",
"command": "NONE"
},
{
"sentence": "Take a picture when you can please.",
"command": "NONE"
},
# Commands with one action and one location
{
"sentence": "Fly to the Sonic on West Cary St.",
"command": "GOTO \tSonic on West Cary St."
},
{
"sentence": "Check out the gym at Cary St.",
"command": "GOTO \tgym at Cary St"
},
{
"sentence": "Investigate the Rite Aid on Broad and Belevidere.",
"command": "GOTO \tRite Aid on Broad and Belevidere"
},
{
"sentence": "Go to Papa Johns at 1200 W Main St.",
"command": "GOTO \tPapa Johns at 1200 W Main St"
},
{
"sentence": "Go to the orange house on W Grace St.",
"command": "GOTO \torange house on W Grace St"
},
{
"sentence": "Travel to Cabell Library at VCU.",
"command": "GOTO \tCabell Library at VCU"
},
{
"sentence": "Take a picture of the park.",
"command": "TAKEPICTURE \tpark"
},
{
"sentence": "Take a picture of the Kroger on Lombardy St.",
"command": "TAKEPICTURE \tKroger on Lombardy St"
},
# Commands with one action and one location but with extra words
{
"sentence": "Please check out the CVS on W Broad St.",
"command": "GOTO \tCVS on W Broad St"
},
# Commands with multiple actions
{
"sentence": "Go to the purple house on to the left and take a picture.",
"command": "GOTO \tpurple house on to the left\nTAKEPICTURE \tpurple house on to the left"
},
{
"sentence": "Go to Kroger on Iron Bridge and take a picture.",
"command": "GOTO \tKroger on Iron Bridge\nTAKEPICTURE \tKroger on Iron Bridge"
}
# Commands with multiple actions and multiple locations
] |