ArcGPT
Description
ArcGPT is intended to be used with ArcGIS Pro and be run within the python window. ArcGPT relies on ChatGPT function calling to call arcpy functions to perform various tasks in ArcGIS Pro using natural language prompts. It is essentially a collection of ChatGPT function call functions that call geoprocessing tools via arcpy.
Dependencies
- ArcGIS Pro Desktop 2.9x or newer
- An OpenAI API Key
- Python 3.7x or newer
- arcpy (comes with your ArcGIS Pro installation)
Getting Started
Follow the instructions on the below wiki page to setup your development environment. https://dev.azure.com/ngisaus/RND-GENAI/_wiki/wikis/RND-GENAI.wiki/331/ArcGPT-Dev-Environment-Setup
Once your environment setup has been completed, if running a standalone script, you can call arcGPT using the method below.
import arcgpt
openaiKey = "[OPENAI KEY]"
llmModel= "gpt-3.5-turbo"
workspace = r"C:\temp"
reply = agent.query([USER INPUT COMMAND])
print(reply)
Currently Supported Functions
ArcGPT uses the ChatGPT function calling feature to inform the ChatGPT model about all the supported functions. The functions are generally calls to arcpy geoprocessing tools. The currently implemented functions are listed below:
Get Current Weather
Description: Get the current weather in a given location - CURRENTLY HARD CODED FOR DEMO PURPOSES
ChatGPT Function:
get_current_weather
Example Query:
"What is the weather in Perth today?"
Limitations: Currently configured for demo purposes only - hard coded values return the same weather conditions for any input location.
Get Schools in Suburb
Description: Get the schools that exist in any Western Australian suburb - outputs a new feature class in the ArcGIS Pro project's default GDB. Queries SLIP map services to obtain a suburb boundary, then uses the boundary to find any contained schools.
ChatGPT Function:
getSchoolsInSuburb
Example Query:
"Which schools are in Perth?"
Limitations: Currently only viable for WA suburbs, if a suburb contains no schools, the tool will fail.
Additional Notes
- While the code is running, the ArcGPT agent will maintain a chat/message history, as per a normal chatGPT session. If multiple queries are sent to the agent, the message history will build and provide the agent with additional context.
- To retrieve the message history, you can use the method below.
messages = agent.message_history
- arcgpt will never delete or edit any data, it will only create new feature classes.
- all your commands are going to OpenAI to generate the responses so just be aware of that.
- arcgpt uses the gpt-3.5-turbo model by default, other models are available, see https://platform.openai.com/docs/models
- To update the model used to create a new agent, you can change the model parameter as below.
import arcgpt
openaiKey = "[OPENAI KEY]"
llmModel= "[MODEL NAME]" # e.g. gpt-4
workspace = r"C:\temp"
reply = agent.query([USER INPUT COMMAND])
print(reply)
Metadata
Release files for arcgpt 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| arcgpt-0.1.2.tar.gz | 5.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| arcgpt-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.7 kB
Release files / arcgpt-0.1.2.tar.gz
| Download URL | arcgpt-0.1.2.tar.gz |
|---|---|
| Size | 5.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
277b586440e673c28fde9dc9349910d81a5911a5e1b9fbd7f07e0d18415509fa
|
|
BLAKE2b-256 checksum How to use checksums |
fd4a1c3735b7367b70968d2f789a38a0837f8bf8441f6cd973dfcfe73a2e5ba4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.7.0 CPython/3.11.6 Windows/10
|
Release files / arcgpt-0.1.2-py3-none-any.whl
| Download URL | arcgpt-0.1.2-py3-none-any.whl |
|---|---|
| Size | 6.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f71a075b5e03f4d49b913f4e2b99bb6703b96c394991d1852bb29bd7e7ddbd60
|
|
BLAKE2b-256 checksum How to use checksums |
a49e0ca1aa58ebe8f073469edec79ddc8f1563da92cced050de287e9b5575677
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.7.0 CPython/3.11.6 Windows/10
|