Basic Prompt Structure
The Claude for Sheets extension offers several functions you can use to call Claude. One such function is CLAUDEMESSAGES(), which is built to reflect the Messages API structure.
CLAUDEMESSAGES() can take several parameters, in the following order:
- Your prompt, in quotation marks
- The model version, in quotation marks
- Any optional additional parameters, such as temperature, system prompt, max tokens, etc.
Anywhere in this sheet, you can call Claude by using the CLAUDEMESSAGES() formula. The basic formula is structured like this: =CLAUDEMESSAGES("{PROMPT}", "{MODEL_VERSION}", "system", "{SYSTEM_PROMPT}")
For example, to call Claude 3 Haiku with a prompt located in cell A1, you would write: =CLAUDEMESSAGES(A1, "claude-3-haiku-20240307", "system", "Respond only in Esperanto")
How does the CLAUDEMESSAGES() structure correlate with the Messages API structure? Let's look a few examples of prompts sent to CLAUDEMESSAGES() along with the underlying formula.
Examples
Hi Claude, how are you?Response will be generated by the LLMCan you tell me the color of the ocean?Response will be generated by the LLMWhat year was Celine Dion born in?Response will be generated by the LLMWhat year was Celine Dion born in?
User: Also, can you tell me some other facts about her?Response will be generated by the LLMWhat year was Celine Dion born in?⚠️=CLAUDEMESSAGES prompt should be in "User: ...
Assistant: ..." format, with "User: ..." first and a newline before each subsequent role. For newlines, press Ctrl/Cmd+Enter⚠️Your answer should always be a series of critical thinking questions that further the conversation (do not provide answers to your questions). Do not actually answer the user question.
Why is the sky blue?Response will be generated by the LLMPlayground
EditableTry modifying these prompts and sending them to your configured LLM provider.