Skip to content

Commit

Permalink
优化提示词
Browse files Browse the repository at this point in the history
  • Loading branch information
239573049 committed Sep 22, 2024
1 parent f2bfdb3 commit 1b2659c
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 12 deletions.
1 change: 1 addition & 0 deletions AutoGpt.sln.DotSettings.user
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AAsyncTaskMethodBuilder_00601_002Ecs_002Fl_003AC_0021_003FUsers_003F23957_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E2_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F24372012c6c94138bf3f496e104366ffc8f918_003F85_003Fa62566b1_003FAsyncTaskMethodBuilder_00601_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AAwaitTaskContinuation_002Ecs_002Fl_003AC_0021_003FUsers_003F23957_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E2_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F24372012c6c94138bf3f496e104366ffc8f918_003Fe3_003Fea83f96b_003FAwaitTaskContinuation_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AEnumerable_002Ecs_002Fl_003AC_0021_003FUsers_003F23957_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E2_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fca6bf72c27214e9bbbce02bd09f96e2e848a0_003Fde_003Fa65d29e2_003FEnumerable_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AExecutionContext_002Ecs_002Fl_003AC_0021_003FUsers_003F23957_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E2_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F24372012c6c94138bf3f496e104366ffc8f918_003Fcc_003Fe59834e1_003FExecutionContext_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ALazy_00601_002Ecs_002Fl_003AC_0021_003FUsers_003F23957_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E2_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F24372012c6c94138bf3f496e104366ffc8f918_003F72_003F47d16d8b_003FLazy_00601_002Ecs/@EntryIndexedValue">ForceIncluded</s:String></wpf:ResourceDictionary>
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<VersionSuffix>4</VersionSuffix>
<VersionSuffix>5</VersionSuffix>
<VersionPrefix>1.0</VersionPrefix>
<Version>$(VersionPrefix).$(VersionSuffix)</Version>
<Authors>AIDotNet</Authors>
Expand Down
4 changes: 2 additions & 2 deletions src/AutoGpt.Tests/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
.AddAutoGpt((options =>
{
options.Endpoint = "https://api.token-ai.cn/";
options.NumOutputs = 5;
options.NumOutputs = 8;
}));

var serviceProvider = service.BuildServiceProvider();
Expand All @@ -16,7 +16,7 @@

var sw = Stopwatch.StartNew();
await foreach (var make in autoGptClient.GenerateResponseAsync(
"0.9 和0.11哪个大", "sk-m1kRV1B3CiXyysrtQq1AApdOEDRfIY68w5frAe", "gpt-4o-mini-2024-07-18",
"使用c#设计工厂模式,并且给出代码案例", "sk-m1kRV1B3CiXyysrtQq1AApdOEDRfIY68w5frAe", "gpt-4o-mini-2024-07-18",
2000))
{
if (make.Type == MakeResultDto.MakeResultType.FinalAnswer)
Expand Down
4 changes: 2 additions & 2 deletions src/AutoGpt/AutoGptClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ await openAiApi.Chat.CreateChatCompletionAsync(new ChatRequest()
Temperature = 0.2
});

var content = response.Choices.FirstOrDefault()?.Message.TextContent ?? string.Empty;
var content = response?.Choices?.FirstOrDefault()?.Message.TextContent ?? string.Empty;

var result = JsonSerializer.Deserialize<List<MakeResultDto>>(content, _jsonSerializerOptions);

Expand Down Expand Up @@ -225,7 +225,7 @@ public MakeResultDto(string title, string content, string nextAction, MakeResult

[JsonPropertyName("next_action")] public string? NextAction { get; set; }

[JsonPropertyName("type")] public MakeResultType Type { get; set; }
[JsonPropertyName("type")] public MakeResultType? Type { get; set; }

public enum MakeResultType
{
Expand Down
14 changes: 7 additions & 7 deletions src/AutoGpt/PromptManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ public class PromptManager : IPromptManager
{
{
"system", """
You are a professional AI assistant, explaining your reasoning step by step. For each step, provide a title that describes what you did in that step and what it is. Decide if you need to take the next step, or if you're ready to give a final answer. Respond to the 'title', 'content' and 'next_action' ('continue' or 'final_answer') keys in JSON format. Use as many reasoning steps as possible. At least three. Be aware of your limitations as an LLM and what you can and cannot do. In your reasoning, include a search for other answers. Consider that you may be wrong, and if your reasoning is wrong, where would it be. Fully test all other possibilities. You could be wrong. When you say you're rechecking, you're actually rechecking, and using a different approach.
Make Chinese reply me.
Don't just say you're reevaluating. Derive the answer in at least three ways. Use best practices.
Do not print "{" and"} ".
An example of a valid JSON response:
你是一个专业的AI助手,一步一步地解释你的思维推理,你的思维推理过程就像人类思考的过程一样是一个很长的流程对一个东西的透彻逐步拆解分析。对于每一步,提供一个标题,描述你在这一步中做了什么,它是什么。决定你是否需要采取下一步行动,或者你是否准备好给出最后的答案。以JSON格式响应'title' 'content''next_action' ('continue''final_answer')键。使用尽可能多的心理推理步骤。至少三个。要意识到你作为法学硕士的局限性,以及你能做什么和不能做什么。在你的思维推理中包括寻找其他答案。考虑到你可能是错的,如果你的思维推理是错的,它会在哪里。充分测试所有其他可能性。你可能错了。当你说你在重新检查时,你实际上是在重新检查,并且使用了不同的方法。
中文回复。
不要只是说你在重新评估。至少用三种方法推导出答案。使用最佳实践。
不要打印“{”和“}”。
一个有效的JSON响应示例:
[{
title: identifies key information.
"Content" : "To begin to solve this problem, we need to carefully examine the given information and identify the key elements that will guide our solution process." It involves..."
title: 标识关键信息。
"Content" : "为了开始解决这个问题,我们需要仔细检查给定的信息,并确定将指导我们解决方案过程的关键要素。”它涉及到…"
next_action: Continue.
}]
"""
Expand Down

0 comments on commit 1b2659c

Please sign in to comment.