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

Define a Prompt Builder #45

Merged
merged 1 commit into from
Jul 18, 2024
Merged

Define a Prompt Builder #45

merged 1 commit into from
Jul 18, 2024

Conversation

ksylvest
Copy link
Owner

@ksylvest ksylvest commented Jul 17, 2024

Compatibility with features like tools and files / URLs introduces a number of complexities when not using a standardized API for prompts. This swaps to use a better API when building prompts

Usage

w/ a basic prompt

completion = client.chat('What is the capital of Japan?')

w/ a complex prompt

completion = client.chat do |prompt|
  prompt.system 'You are a helpful assistant with an expertise in animals.'
  prompt.user do |message|
    message.text 'What animals are in the attached photos?'
    message.url('https://.../cat.jpeg', "image/jpeg")
    message.url('https://.../dog.jpeg', "image/jpeg")
    message.file('./hamster.jpeg', "image/jpeg")
  end
end

@ksylvest ksylvest force-pushed the ksylvest/prompt-builder branch 8 times, most recently from 5868e67 to 51f52d0 Compare July 18, 2024 18:53
@ksylvest ksylvest merged commit 641e2a3 into main Jul 18, 2024
8 checks passed
@ksylvest ksylvest deleted the ksylvest/prompt-builder branch August 20, 2024 01:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant