You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/guides/chat.md
+6-1Lines changed: 6 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -69,6 +69,11 @@ See [Working with Models]({% link guides/models.md %}) for more details on model
69
69
70
70
## Instructions (aka System Prompts)
71
71
72
+
{: .warning-title }
73
+
> Coming in v1.1.0
74
+
>
75
+
> chat.with_instructions is coming in 1.1.0. 1.0.x users should use `add_message role: system, content: PROMPT`
76
+
72
77
System prompts allow you to set specific instructions or context that guide the AI's behavior throughout the conversation. These prompts are not directly visible to the user but help shape the AI's responses:
73
78
74
79
```ruby
@@ -81,7 +86,7 @@ chat.with_instructions "You are a helpful Ruby programming assistant. Always inc
81
86
# Now the AI will follow these instructions in all responses
82
87
response = chat.ask "How do I handle file operations in Ruby?"
83
88
84
-
# You can add multiple system messages or update them during the conversation
89
+
# You can add multiple system messages or update them during the conversation - available from 1.1.0
85
90
chat.with_instructions "Always format your code using proper Ruby style conventions and include comments."
Copy file name to clipboardExpand all lines: docs/guides/rails.md
+7-2Lines changed: 7 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -130,20 +130,25 @@ end
130
130
131
131
## Instructions (aka System Prompts)
132
132
133
+
{: .warning-title }
134
+
> Coming in v1.1.0
135
+
>
136
+
> chat.with_instructions is coming in 1.1.0. 1.0.x users should use `chat.messages.create! role: system, content: PROMPT`
137
+
133
138
Instructions help guide the AI's behavior throughout a conversation. With Rails integration, these messages are automatically persisted just like regular chat messages:
134
139
135
140
```ruby
136
141
# Create a new chat
137
142
chat =Chat.create!(model_id:'gpt-4o-mini')
138
143
139
-
# Add instructions (these are persisted)
144
+
# Add instructions (these are persisted) - available from 1.1.0
140
145
chat.with_instructions("You are a helpful Ruby programming assistant. Always include code examples in your responses and explain them line by line.")
141
146
142
147
# Ask questions - the AI will follow the instructions
143
148
response = chat.ask("How do I handle file operations in Ruby?")
144
149
puts response.content # Will include detailed code examples
145
150
146
-
# Add additional instructions
151
+
# Add additional instructions - available from 1.1.0
147
152
chat.with_instructions("Always format your code using proper Ruby style conventions and include comments.")
0 commit comments