Skip to content

Commit

Permalink
Copy edits for get started article
Browse files Browse the repository at this point in the history
  • Loading branch information
cpsievert committed Dec 4, 2024
1 parent e886f94 commit a3d356a
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions docs/get-started.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -48,31 +48,31 @@ Writing a good prompt, which is called __prompt design__, is key to effective us

## Example uses

Now that you've got the basic vocab under your belt, I'm going to fire a bunch of interesting potential use cases at you. Many of these use cases have existing special purpose tools that might be faster, or cheaper, or both. But using an LLM allows you to rapidly prototype an idea, and this is extremely valuable, even if you end up using a more specialised tool for the final product.
Now that you've got the basic vocab under your belt, I'm going to fire a bunch of interesting potential use cases at you. While there are special purpose tools that might solve these cases faster and/or cheaper, an LLM allows you to rapidly prototype a solution. This can be extremely valuable even if you end up using those more specialised tools in your final product.

In general, we recommend avoiding LLMs where accuracy is critically important. But that still allows for a wide variety of uses. For example, there are plenty of cases where an 80% correct solution which always requires some manual fiddling might still save you a bunch of time. In other cases, a not-so-good solution can still make it much easier to get started: it's easier to react to something existing rather than starting from scratch with a blank page.
In general, we recommend avoiding LLMs where accuracy is critical. That said, there are still many cases for their use. For example, even though they always requires some manual fiddling, you might save a bunch of time evern with an 80% correct solution. In fact, even a not-so-good solution can still be useful because it makes it easier to get started: it's easier to react to something rather than to have to start from scratch with a blank page.

### Chatbots

A great place to start with chatlas and LLMs is to [build a chatbot](web-apps.qmd) with a custom prompt. Chatbots are familiar interface and easy to create via web application framework like Shiny or Streamlit. And there's surprising amount of value to creating a custom chatbot that has a prompt stuffed with useful knowledge. For example:
A great place to start with chatlas and LLMs is to [build a chatbot](web-apps.qmd) with a custom prompt. Chatbots are familiar interface and are easy to create via web application framework like Shiny or Streamlit. And there's a surprising amount of value to creating a custom chatbot that has a prompt stuffed with useful knowledge. For example:

* Maybe you want to help people use your new package. You need a custom prompt because LLMs were trained on data before your package exists. You can create a surprisingly useful tool just by preloading the prompt with your README and other vignettes. This is how the [chatlas assistant](https://github.com/cpsievert/chatlas-assistant) works.
* Help people use your new package. To do so, you need a custom prompt because LLMs were trained on data prior to your package's existence. You can create a surprisingly useful tool just by preloading the prompt with your README and other documentation. This is how the [chatlas assistant](https://github.com/cpsievert/chatlas-assistant) works.

* [Shiny assistant](https://shiny.posit.co/blog/posts/shiny-assistant/) helps you build shiny apps (either in Python or R) by combining a [prompt](https://github.com/posit-dev/shiny-assistant/blob/main/shinyapp/app_prompt.md) that gives general advice on building apps with a language specific prompt for [Python](https://github.com/posit-dev/shiny-assistant/blob/main/shinyapp/app_prompt_python.md) or [R](https://github.com/posit-dev/shiny-assistant/blob/main/shinyapp/app_prompt_r.md). The Python prompt is very detailed because there's much less information about Shiny for Python in the existing LLM knowledgebases.
* Build language specific prompts for Python and/or R. [Shiny assistant](https://shiny.posit.co/blog/posts/shiny-assistant/) helps you build shiny apps (either in Python or R) by combining a [prompt](https://github.com/posit-dev/shiny-assistant/blob/main/shinyapp/app_prompt.md) that gives general advice on building apps with a prompt for [Python](https://github.com/posit-dev/shiny-assistant/blob/main/shinyapp/app_prompt_python.md) or [R](https://github.com/posit-dev/shiny-assistant/blob/main/shinyapp/app_prompt_r.md). The Python prompt is very detailed because there's much less information about Shiny for Python in the existing LLM knowledgebases.

* If you've written a bunch of documentation for something, you might find that you still get a bunch of questions about it because folks can't easily find exactly what they're looking for. You can reduce the need to answer these questions by creating a chatbot with a prompt that contains your documentation. For example, if you're a teacher, you could create a chatbot that includes your syllabus in the prompt. This eliminates a common class of question where the data necessary to answer the question is already available, but hard to find.
* Help people find the answers to their questions. Even if you've written a bunch of documentation for something, you might find that you still get questions because folks can't easily find exactly what they're looking for. You can reduce the need to answer these questions by creating a chatbot with a prompt that contains your documentation. For example, if you're a teacher, you could create a chatbot that includes your syllabus in the prompt. This eliminates a common class of question where the data necessary to answer the question is available, but hard to find.

Another direction is to give the chatbot additional context about your current environment. For example, [aidea](https://github.com/cpsievert/aidea) allows the user to interactively explore a dataset with the help of the LLM. It adds summary statistics about the dataset to the [prompt](https://github.com/cpsievert/aidea/blob/main/inst/app/prompt.md) so that the LLM knows something about your data. Along the same lines, you could imagine writing a chatbot to help with data import that has a prompt which include all the files in the current directory along with their first few lines.
Another direction is to give the chatbot additional context about your current environment. For example, [aidea](https://github.com/cpsievert/aidea) allows the user to interactively explore a dataset with the help of the LLM. It adds summary statistics about the dataset to the [prompt](https://github.com/cpsievert/aidea/blob/main/inst/app/prompt.md) so that the LLM knows something about your data. Along these lines, imagine writing a chatbot to help with data import that has a prompt which include all the files in the current directory along with their first few lines.

### Structured data extraction

LLMs are often very good at extracting structured data from unstructured text, which can give you traction to analyse data that was previously unaccessible. For example:
LLMs are often very good at extracting structured data from unstructured text. This can give you traction to analyse data that was previously unaccessible. For example:

* Customer tickets and GitHub issues: you can use LLMs for quick and dirty sentiment analysis, extract any specific products mentioned, and summarise the discussion into a few bullet points.
* Customer tickets and GitHub issues: you can use LLMs for quick and dirty sentiment analysis by extracting any specifically mentioned products and summarising the discussion as a few bullet points.

* Geocoding: LLMs do a surprisingly good job at geocoding, especially to extract addresses or find the latitute/longitude of cities. There are specialised tools that do this better, but using an LLM makes it easy to get started.
* Geocoding: LLMs do a surprisingly good job at geocoding, especially extracting addresses or finding the latitute/longitude of cities. There are specialised tools that do this better, but using an LLM makes it easy to get started.

* Recipes: I've extracted structured data from baking and cocktail recipes. Once you have the data in a structured form you can use your Python skills to better understand how recipes vary within a cookbook or you could look for recipes that use the ingredients that you currently have in your kitchen. Or you could use [shiny assistant](https://gallery.shinyapps.io/assistant/) to help make those techniques available to anyone, not just Python users.
* Recipes: I've extracted structured data from baking and cocktail recipes. Once you have the data in a structured form you can use your Python skills to better understand how recipes vary within a cookbook or to look for recipes that use the ingredients that you currently have in your kitchen. You could even use [shiny assistant](https://gallery.shinyapps.io/assistant/) to help make those techniques available to anyone, not just Python users.

Structured data extraction also work works well with images. It's not the fastest or cheapest way to extract data but it makes it really easy to prototype ideas. For example, maybe you have a bunch of scanned documents that you want to index. You can convert PDFs to images (e.g. using something like [`pdf2image`](https://pypi.org/project/pdf2image/)) then use structured data extraction to pull out key details.

Expand All @@ -99,10 +99,10 @@ LLMs can also be useful to solve general programming problems. For example:

## Miscellaneous

To finish up here are a few other ideas that seem cool but didn't seem to fit in the other categories:
To finish up here are a few other ideas that seem cool but didn't seem to fit the above categories:

* Automatically generate alt text for plots, using `content_image_plot()`.

* Try analysing the text of your statistical report and look for flaws in your statistical reasoning. (e.g. misinterpreting p-values or assuming causation where only correlation exists.)
* Analyse the text of your statistical report to look for flaws in your statistical reasoning (e.g. misinterpreting p-values or assuming causation where only correlation exists).

* Use your existing company style guide to generate a [brand.yaml](https://posit-dev.github.io/brand-yml/articles/llm-brand-yml-prompt/) specification to automatically style your reports, apps, dashboards, plots to match your corporate style guide.
* Use your existing company style guide to generate a [brand.yaml](https://posit-dev.github.io/brand-yml/articles/llm-brand-yml-prompt/) specification to automatically style your reports, apps, dashboards and plots to match your corporate style guide.

0 comments on commit a3d356a

Please sign in to comment.