Skip to content
代码片段 群组 项目
提交 bd653711 编辑于 作者: Gosia Ksionek's avatar Gosia Ksionek 提交者: Jan Provaznik
浏览文件

Remove alternative ff

Changelog: changed
上级 ad55f6d7
No related branches found
No related tags found
无相关合并请求
---
name: ai_chat_prompt_alternative
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/125092
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/417230
milestone: '16.2'
type: development
group: group::ai-enablement
default_enabled: false
......@@ -92,11 +92,7 @@ def options
end
def prompt_version
if Feature.enabled?(:ai_chat_prompt_alternative, context.current_user)
ALTERNATIVE_PROMPT_TEMPLATE
else
PROMPT_TEMPLATE
end
PROMPT_TEMPLATE
end
def last_conversation
......@@ -118,39 +114,6 @@ def conversation
end
PROMPT_TEMPLATE = [
Utils::Prompt.as_system(
<<~PROMPT
Answer the question as accurate as you can.
Start with identifying the resource first.
You have access to the following tools:
%<tools_definitions>s
Consider every tool before making decision.
Identifying resource mustn't be the last step.
Ensure that your answer is accurate and doesn’t contain any information not directly supported
by the information retrieved using provided tools.
Use the following format:
Question: the input question you must answer
Thought: you should always think about what to do
Action: the action to take, should be one from this list: %<tool_names>s
Action Input: the input to the action
Observation: the result of the actions
... (this Thought/Action/Action Input/Observation sequence can repeat N times)
Thought: I know the final answer.
Final Answer: the final answer to the original input question.
REMEMBER to ALWAYS start a line with "Final Answer:" to give me the final answer.
Begin!
PROMPT
),
Utils::Prompt.as_assistant("%<agent_scratchpad>s"),
Utils::Prompt.as_user("Question: %<user_input>s")
].freeze
ALTERNATIVE_PROMPT_TEMPLATE = [
Utils::Prompt.as_system(
<<~PROMPT
Answer the question as accurate as you can.
......
......@@ -132,33 +132,12 @@
end
end
context 'with ai_chat_prompt_alternative feature flag' do
context 'with feature flag off' do
before do
stub_feature_flags(ai_chat_prompt_alternative: false)
end
it 'includes an older version of the prompt' do
expect(Gitlab::Llm::Chain::Agents::ZeroShot::Prompts::Anthropic)
.to receive(:prompt).once.with(a_hash_including(prompt_version: described_class::PROMPT_TEMPLATE))
agent.prompt
end
end
context 'with feature flag on' do
before do
stub_feature_flags(ai_chat_prompt_alternative: true)
end
it 'includes a newer version of the prompt' do
expect(Gitlab::Llm::Chain::Agents::ZeroShot::Prompts::Anthropic)
.to receive(:prompt).once.with(a_hash_including(prompt_version:
described_class::ALTERNATIVE_PROMPT_TEMPLATE))
it 'includes the prompt' do
expect(Gitlab::Llm::Chain::Agents::ZeroShot::Prompts::Anthropic)
.to receive(:prompt).once.with(a_hash_including(prompt_version:
described_class::PROMPT_TEMPLATE))
agent.prompt
end
end
agent.prompt
end
end
......
......@@ -29,7 +29,7 @@
}
end
let(:prompt_text) { "Answer the question as accurate as you can.\nStart with identifying the resource first." }
let(:prompt_text) { "Answer the question as accurate as you can." }
subject { described_class.prompt(options)[:prompt] }
......
......@@ -13,7 +13,7 @@
prompt_version: ::Gitlab::Llm::Chain::Agents::ZeroShot::Executor::PROMPT_TEMPLATE
}
prompt = described_class.prompt(options)[:prompt]
prompt_text = "Answer the question as accurate as you can.\nStart with identifying the resource first."
prompt_text = "Answer the question as accurate as you can."
expect(prompt).to include('foo?')
expect(prompt).to include('tool definitions')
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册