AI Help and Code Generation
Ganymede incorporates OpenAI models to facilitate document search and code generation in Flow development. When configured, these functions can be accessed in notebooks without additional imports by calling the help
and code
functions respectively.
GPT Setup
To set up access for any given environment, ensure that the following variables are set in Environment Administration:
- openai_api_key - API key for the OpenAI service account specific to your tenant
- openai_project - Project ID for the OpenAI service account specific to your tenant
- openai_ganymede_docs_asst - Assistant ID for searching Ganymede documentation
By default, access is configured in non-production environments. Please reach out to Ganymede support to enable this feature in other environments.
Usage
Search Documentation
When enabled, the documentation site can be queried in notebooks by using the help
function. For example:
help("How do I add tags to a file in Ganymede?")
returns a response similar to what is shown below:
Messages sent within a single notebook session will be incorporated into the same OpenAI Thread.
Code Generation
The code
function can be used to generate code snippets in editor notebooks, which can be used as the basis for the execute function. This function generates code for the User-Defined Function section of the notebook based on a provided prompt and files provided.
To try this feature out, you can perform the following steps:
- Create a CSV_Read node in a Flow and open up the corresponding notebook.
- Download this example file and upload this file using the widget in the testing section of the notebook.
- Run the following code in the notebook:
code(query_str='Can you fill out the "execute" function referenced in the instructions to upload the attached data as a table called "results"? Please ignore the first row in the CSV file, treating the second row as the header. Please name the first column in the uploaded file "Well Position".',
files=input_file)
Executing this code will generate a response similar to the one shown below:
Copying and pasting this code into the User-Defined Function section of the notebook will allow you to execute the function and view the results in the notebook.