Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use [!TIP] markdown for pro tips #14

Merged
merged 1 commit into from
Nov 30, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ ai"What is the capital of \$(country)?"
# AIMessage("The capital of Spain is Madrid.")
```

Pro tip: Use after-string-flags to select the model to be called, eg, `ai"What is the capital of France?"gpt4` (use `gpt4t` for the new GPT-4 Turbo model). Great for those extra hard questions!
> [!TIP]
> Use after-string-flags to select the model to be called, eg, `ai"What is the capital of France?"gpt4` (use `gpt4t` for the new GPT-4 Turbo model). Great for those extra hard questions!

For more complex prompt templates, you can use handlebars-style templating and provide variables as keyword arguments:

Expand All @@ -53,9 +54,11 @@ msg = aigenerate("What is the capital of {{country}}? Is the population larger t
# AIMessage("The capital of Spain is Madrid. And yes, the population of Madrid is larger than 1 million. As of 2020, the estimated population of Madrid is around 3.3 million people.")
```

Pro tip: Use `asyncmap` to run multiple AI-powered tasks concurrently.
> [!TIP]
> Use `asyncmap` to run multiple AI-powered tasks concurrently.

Pro tip: If you use slow models (like GPT-4), you can use async version of `@ai_str` -> `@aai_str` to avoid blocking the REPL, eg, `aai"Say hi but slowly!"gpt4`
> [!TIP]
> If you use slow models (like GPT-4), you can use async version of `@ai_str` -> `@aai_str` to avoid blocking the REPL, eg, `aai"Say hi but slowly!"gpt4`

For more practical examples, see the `examples/` folder and the [Advanced Examples](#advanced-examples) section below.

Expand Down Expand Up @@ -225,7 +228,8 @@ prompts = [aigenerate("Translate 'Hello, World!' to {{language}}"; language) for
responses = asyncmap(aigenerate, prompts)
```

Pro tip: You can limit the number of concurrent tasks with the keyword `asyncmap(...; ntasks=10)`.
> [!TIP]
> You can limit the number of concurrent tasks with the keyword `asyncmap(...; ntasks=10)`.

### Model Aliases

Expand Down Expand Up @@ -491,7 +495,8 @@ Resources:
- [OpenAI Documentation](https://platform.openai.com/docs/quickstart?context=python)
- [Visual tutorial](https://www.maisieai.com/help/how-to-get-an-openai-api-key-for-chatgpt)

Pro tip: Always set the spending limits!
> [!TIP]
> Always set the spending limits!

### Setting OpenAI Spending Limits

Expand Down Expand Up @@ -603,4 +608,4 @@ Please note that while PromptingTools.jl aims to provide a smooth experience, it

---

Thank you for choosing PromptingTools.jl to empower your applications with AI!
Thank you for choosing PromptingTools.jl to empower your applications with AI!
Loading