feat: add prompt suggestions and June events (#10726)
This PR adds the following two features 1. Prompt suggestions to get started with Copilot Chat 2. June events for each action  --------- Co-authored-by: Pranav <pranavrajs@gmail.com>
This commit is contained in:
@@ -66,28 +66,33 @@ class Captain::Agent
|
||||
def construct_prompt(config)
|
||||
return config[:prompt] if config[:prompt]
|
||||
|
||||
"
|
||||
<<~PROMPT
|
||||
Persona: #{config[:persona]}
|
||||
Objective: #{config[:goal]}
|
||||
|
||||
Guidelines:
|
||||
- Work diligently until the stated objective is achieved.
|
||||
- Utilize only the provided tools for solving the task. Do not make up names of the functions
|
||||
- Set 'stop: true' when the objective is complete.
|
||||
- DO NOT provide tool_call as final answer
|
||||
- If you have enough information to provide the details to the user, prepare a final result collecting all the information you have.
|
||||
- Persistently work towards achieving the stated objective without deviation.
|
||||
- Use only the provided tools to complete the task. Avoid inventing or assuming function names.
|
||||
- Set `'stop': true` once the objective is fully achieved.
|
||||
- DO NOT return tool usage as the final result.
|
||||
- If sufficient information is available to deliver result, compile and present it to the user.
|
||||
- Always return a final result and ENSURE the final result is formatted in Markdown.
|
||||
|
||||
Output Structure:
|
||||
|
||||
If you find a function, that can be used, directly call the function.
|
||||
1. **Tool Usage:**
|
||||
- If a relevant function is identified, call it directly without unnecessary explanations.
|
||||
|
||||
When providing the final answer, use the JSON format:
|
||||
{
|
||||
'thought_process': 'Describe the reasoning and steps that led to the final result.',
|
||||
'result': 'The complete answer in text form.',
|
||||
'stop': true
|
||||
}
|
||||
"
|
||||
2. **Final Answer:**
|
||||
When ready to provide a complete response, follow this JSON format:
|
||||
|
||||
```json
|
||||
{
|
||||
"thought_process": "Explain the reasoning and steps taken to arrive at the final result.",
|
||||
"result": "Provide the complete response in clear, structured text.",
|
||||
"stop": true
|
||||
}
|
||||
PROMPT
|
||||
end
|
||||
|
||||
def prepare_tools(tools = [])
|
||||
@@ -126,7 +131,7 @@ class Captain::Agent
|
||||
end
|
||||
|
||||
def push_to_messages(message)
|
||||
@logger.info("Message: #{message}")
|
||||
@logger.info("\n\n\nMessage: #{message}\n\n\n")
|
||||
@messages << message
|
||||
end
|
||||
end
|
||||
|
||||
@@ -2,15 +2,16 @@ require 'openai'
|
||||
|
||||
class Captain::LlmService
|
||||
def initialize(config)
|
||||
@client = OpenAI::Client.new(access_token: config[:api_key]) do |f|
|
||||
f.response :logger, Logger.new($stdout), bodies: true
|
||||
end
|
||||
@client = OpenAI::Client.new(
|
||||
access_token: config[:api_key],
|
||||
log_errors: Rails.env.development?
|
||||
)
|
||||
@logger = Rails.logger
|
||||
end
|
||||
|
||||
def call(messages, functions = [])
|
||||
openai_params = {
|
||||
model: 'gpt-4o-mini',
|
||||
model: 'gpt-4o',
|
||||
response_format: { type: 'json_object' },
|
||||
messages: messages
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user