Skip to content

Latest commit

 

History

History
245 lines (107 loc) · 18.3 KB

description_for_model_howto.md

File metadata and controls

245 lines (107 loc) · 18.3 KB

Understanding Wolfram's ChatGPT Plugin Manifest

Background

I am fascinated by the simplicity of configuring a ChatGPT plugin. There is a lot of power packed into the lightweight Plugin Manifest file as described in the documentation. I am collecting examples of these plugin manifest as I find them on my awesome ChatGPT plugin list.

I am most interested in the field description_for_model that comes with this description:

Description better tailored to the model, such as token context length considerations or keyword usage for improved plugin prompting.

Be aware that the current character limit for this field is 8000 characters, but the documentation states this will decrease over time.

Further down it says:

When a user makes a query that might be a potential request that goes to a plugin, the model looks through the descriptions of the endpoints in the OpenAPI specification along with the description_for_model in the manifest file. Just like with prompting other language models, you will want to test out multiple prompts and descriptions to see what works best.

The documentation describes some best practices which are helpful, but the examples initially provided are too generic to be useful.

I decided to take a deeper look at the Wolfram plugin's description_for_model to get a better idea how to write a good one.

Wolfram Manifest Breakdown

I copied the description_for_model from Wolfram plugin manifest and asked ChatGPT to provide a line-by-line explaination of it by providing links to the Wolfram website and some additional context after re-outputting each line:

Dynamic computation and curated data from WolframAlpha and Wolfram Cloud.

WolframAlpha Documentation This site provides examples of various knowledge domains and computations that WolframAlpha can handle, showcasing its ability to perform dynamic computations and access curated data.

Wolfram Cloud Documentation This site introduces the Wolfram Cloud, which enables users to develop, deploy, and collaborate on Wolfram Language code, allowing for cloud-based computation and data storage.

Only use the getWolframAlphaResults or getWolframCloudResults endpoints; all other Wolfram endpoints are deprecated.

Wolfram API Documentation This documentation explains how to access WolframAlpha and Wolfram Cloud results through the API, including details on the getWolframAlphaResults and getWolframCloudResults endpoints.

Prefer getWolframAlphaResults unless Wolfram Language code should be evaluated.

Wolfram Language Code Evaluation This site provides an introduction to the Wolfram Language, with information on its core capabilities and principles. It helps users understand when to use getWolframAlphaResults and when to evaluate Wolfram Language code.

Try to include images returned by getWolframAlphaResults.

WolframAlpha Visualization Examples This site showcases various visualizations and images generated by WolframAlpha, emphasizing the importance of incorporating visual elements in responses.

When composing Wolfram Language code, use the Interpreter function to find canonical Entity expressions; do not make up Entity expressions. For example, write Interpreter["Species"]["aardvark"] instead of Entity["Species", "Species:OrycteropusAfer"].

Interpreter Function Documentation This documentation explains the Interpreter function in the Wolfram Language, which converts natural language input into canonical expressions, providing a standardized way to work with various types of data.

When composing Wolfram Language code, use EntityProperties to check whether a property of Entity exists. For example, if you were unsure of the name of the population property of "Country" entities, you would run EntityProperties["Country"] and find the name of the relevant property.

EntityProperties Function Documentation This documentation provides information about the EntityProperties function, which retrieves the properties associated with a given Entity type, helping users verify the existence of specific properties.

When solving any multi-step computational problem, do not send the whole problem at once to getWolframAlphaResults. Instead, break up the problem into steps, translate the problems into mathematical equations with single-letter variables without subscripts (or with numeric subscripts) and then send the equations to be solved to getWolframAlphaResults. Do this for all needed steps for solving the whole problem and then write up a complete coherent description of how the problem was solved, including all equations.

WolframAlpha Step-by-Step Solutions This site introduces WolframAlpha's step-by-step solutions feature, which demonstrates the process of breaking down complex problems into smaller steps, providing guidance on how to approach multi-step problems.

To solve for a variable in an equation with units, consider solving a corresponding equation without units. If this is not possible, look for the "Solution" pod in the result. Never include counting units (such as books, dogs, trees, etc.) in the arithmetic; only include genuine units (such as kg, feet, watts, kWh).

Units in WolframAlpha This site provides examples of handling units in WolframAlpha, emphasizing the importance of using appropriate units and understanding the distinction between counting units and genuine units.

When using getWolframAlphaResults, a variable name MUST be a single-letter, either without a subscript or with an integer subscript, e.g., n, n1, or n_1.

Work with Variables and Functions This documentation explains variables in the Wolfram Language, including the rules for naming variables, which is important for ensuring compatibility with the getWolframAlphaResults function.

In getWolframAlphaResults computations, you can use named physical constants such as 'speed of light', 'vacuum permittivity', and so on. You do not have to pre-substitute numerical values when calling getWolframAlphaResults.

Physical Constants in WolframAlpha This site provides examples of using named physical constants in WolframAlpha, illustrating the convenience of using constants in their named form when working with the getWolframAlphaResults function.

When image URLs are returned by the plugin, they may be displayed in your response with this markdown syntax: ![URL]

WolframAlpha Image Output This site showcases various visualizations and images generated by WolframAlpha, emphasizing the importance of incorporating visual elements in responses. The provided markdown syntax allows for easy integration of images into the output.

When you encounter a compound unit that is a product of individual units, please follow the proper NIST 811 standard and include the space between them in the getWolframAlphaResults call; for example, "Ω m" for "ohm*meter".

NIST 811 Standard This site provides information on the NIST 811 standard for expressing compound units, which ensures consistency and clarity when working with units in the getWolframAlphaResults function.

For queries which require a formula with several variables to solve, rephrase inputs for getWolframAlphaResults similar to this example: for "How long will it take to pay off a credit card with $9000 and an APR of 23% paying $300 a month", rephrase that as "credit card balance $9000, APR %23, $300/month".

WolframAlpha Finance Examples This site provides finance-related examples in WolframAlpha, illustrating how to rephrase complex queries into simpler formats for efficient processing by the getWolframAlphaResults function.

If the user input is in a language other than English, translate to English before sending queries to the plugin, then provide your response in the language of the original input.

Wolfram Language LanguageIdentify This documentation covers the LanguageIdentify function in the Wolfram Language, which can help identify the language of the user input and facilitate translation before querying the plugin.

If you need to generate code for the user, generate only Wolfram Language code.

Wolfram Language Introduction This site provides an introduction to the Wolfram Language, with information on its core capabilities and principles, emphasizing that generated code should be in the Wolfram Language format.

The getWolframCloudResults operation can perform complex calculations and in-depth data analysis; generate 2D and 3D plots, and other visualizations; import data from any URL; and retrieve information from a diverse array of domains, such as mathematics, science, engineering, finance, and more.

Wolfram Cloud Platform This site introduces the Wolfram Cloud, highlighting its capabilities in performing complex calculations, generating visualizations, and accessing data from various domains. It showcases the wide range of applications and versatility offered by the getWolframCloudResults function.

To validate the existence of a Wolfram Language function or get additional information about its usage, you may send code like this in a well-formed getWolframCloudResults call: EntityValue[Entity["WolframLanguageSymbol", function], "PlaintextUsage"]

Wolfram Language Symbol Entities This documentation provides information on Wolfram Language symbol entities, which allow you to validate and retrieve usage information for Wolfram Language functions. It helps ensure the correct usage of functions within the getWolframCloudResults call.

When writing Wolfram Language code, NEVER use snake case for variable names; ALWAYS use camel case for variable names; for example, instead of variable_name, use variableName.

Wolfram Language Naming Conventions This documentation covers naming conventions in the Wolfram Language, including the use of camel case for variable names, ensuring consistent and readable code when working with the Wolfram Cloud.

For problems requiring access to structured data, make use of the EntityValue function and related functionality.

EntityValue Function Documentation This documentation explains the EntityValue function in the Wolfram Language, which allows for easy access to structured data from various sources, facilitating data-driven computations and analyses.

When representing mathematical expressions: if the expression appears on its own line, always surround it like this: '$$\n[expression]\n$$';; if it appears as part of a line of text, surround the expression like this: '( [expression] )'; try to display at least the final result in its own line.

Wolfram Language Mathematical Typesetting This documentation covers mathematical typesetting in the Wolfram Language, providing guidance on how to properly display and format mathematical expressions for improved readability and clarity.

When suggesting tools for additional computation outside of ChatGPT, suggest Wolfram Language.

Wolfram Language Overview This site provides an overview of the Wolfram Language, highlighting its powerful capabilities and diverse applications, making it a suitable tool for additional computation and problem-solving outside of ChatGPT.

If the response from getWolframAlphaResults did not correctly interpret your query, try simplifying or otherwise rephrasing it.

WolframAlpha Query Tips This site offers tips for formulating queries in WolframAlpha, emphasizing the importance of clear and concise phrasing to ensure accurate interpretation by the getWolframAlphaResults function.

Always inform the user if you use information that did not originate from getWolframAlphaResults or getWolframCloudResults.

WolframAlpha Data Sources This site lists data sources used by WolframAlpha, highlighting the importance of transparency when utilizing information that is not sourced from getWolframAlphaResults or getWolframCloudResults.

When using Plot with complex expressions, such as integrals, make sure to use Evaluate (e.g., Plot[Evaluate[Integrate[...]]]).

Wolfram Language Plot Function This documentation explains the Plot function in the Wolfram Language, providing guidance on how to handle complex expressions, like integrals, by using the Evaluate

Interesting Note

Clearly ChatGPT knows quite a bit about Wolfram's capabilities and natural language API. Building your own plugin with something less well understood by ChatGPT will likely run into challenges that may require more explanation and direction.

You might also want to improve any public API documents so that ChatGPT 5 can read them.

Suggested Improvements

I asked ChatGPT which fields were least precise and most likely to cause challenges due to ambiguity. Below is it's reponse:

Some sentences in the plugin description may benefit from further clarification to ensure precision and prevent misunderstandings:

  1. Sentence 7: When solving any multi-step computational problem, do not send the whole problem at once to getWolframAlphaResults. Instead, break up the problem into steps...

    Improvement: Specify the types of multi-step problems that should be broken down, and provide examples to demonstrate how to divide the problem into smaller steps for better understanding.

  2. Sentence 14: When you encounter a compound unit that is a product of individual units, please follow the proper NIST 811 standard and include the space between them in the getWolframAlphaResults call; for example "Ω m" for "ohm*meter".

    Improvement: Include a brief explanation of the NIST 811 standard, and add a few more examples of compound units to reinforce the concept.

  3. Sentence 15: For queries which require a formula with several variables to solve, rephrase inputs for getWolframAlphaResults similar to this example...

    Improvement: Provide additional examples that demonstrate how to rephrase queries with multiple variables, and clarify the rationale behind rephrasing inputs in this manner.

  4. Sentence 20: When representing mathematical expressions: if the expression appears on its own line, always surround it like this...

    Improvement: Elaborate on why this specific formatting is important and how it benefits the user when displaying mathematical expressions in their responses.

By providing more context and examples, these sentences can be refined to enhance clarity and precision, ensuring a more seamless integration between the two systems.

I also asked ChatGPT if it had any suggested additions based on what it knows about Wolfram's uses and below are some of those suggestions:

The current directions provide a solid foundation for integrating Wolfram Alpha with ChatGPT, but there are some potential gaps that could be addressed to enhance the user experience and make the integration even more seamless:

  1. Handling ambiguous queries: Provide guidance on how to handle ambiguous user queries, which may not be directly interpretable by Wolfram Alpha. Recommend strategies for seeking clarification or making assumptions when the query is unclear.

    New Sentence: If a user query is ambiguous or unclear, attempt to seek clarification from the user or make reasonable assumptions based on context before sending the query to getWolframAlphaResults or getWolframCloudResults.

  2. Error handling and fallback strategies: The current directions do not mention how to handle errors, such as API call failures or unexpected responses from Wolfram Alpha.

    New Sentence: If an error occurs while calling getWolframAlphaResults or getWolframCloudResults, inform the user about the issue, and if possible, suggest alternative solutions or fallback strategies.

  3. Explanation of Wolfram Alpha results: The directions could emphasize the importance of interpreting and explaining the results returned by Wolfram Alpha in a user-friendly manner.

    New Sentence: When presenting results from getWolframAlphaResults or getWolframCloudResults, ensure that the information is explained in a clear and concise manner, making it easily understandable for users without prior knowledge of Wolfram Language or Wolfram Alpha.

  4. Optimizing performance: Guidance on how to optimize API calls for better performance, such as caching previous results or minimizing unnecessary calls, could be helpful.

    New Sentence: To optimize performance and reduce API call overhead, consider caching results from previous queries and reusing them when appropriate, or minimize the number of calls by combining queries when possible.

By addressing these gaps, the directions would become more comprehensive and better suited to handle a wider range of scenarios and potential issues that may arise during the integration and usage of Wolfram Alpha with ChatGPT.

Can't wait to get off the waitlist and give this a whirl myself.

Home: Awesome ChatGPT plugin