Skip to main content

A ChatGPT powered library for controling ArcGIS Pro using natural language prompts.

Project description

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)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

arcgpt-0.1.2.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

arcgpt-0.1.2-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

Details for the file arcgpt-0.1.2.tar.gz.

File metadata

  • Download URL: arcgpt-0.1.2.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.0 CPython/3.11.6 Windows/10

File hashes

Hashes for arcgpt-0.1.2.tar.gz
Algorithm Hash digest
SHA256 277b586440e673c28fde9dc9349910d81a5911a5e1b9fbd7f07e0d18415509fa
MD5 6572aa98615d64696133311717a13101
BLAKE2b-256 fd4a1c3735b7367b70968d2f789a38a0837f8bf8441f6cd973dfcfe73a2e5ba4

See more details on using hashes here.

File details

Details for the file arcgpt-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: arcgpt-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 6.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.0 CPython/3.11.6 Windows/10

File hashes

Hashes for arcgpt-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f71a075b5e03f4d49b913f4e2b99bb6703b96c394991d1852bb29bd7e7ddbd60
MD5 83f971878b4be7f2f1b1d3a92eee52f3
BLAKE2b-256 a49e0ca1aa58ebe8f073469edec79ddc8f1563da92cced050de287e9b5575677

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page