mirror of
https://github.com/microsoft/autogen.git
synced 2025-10-18 11:29:07 +00:00
simple dev understanding
This commit is contained in:
parent
31eaa4c3ce
commit
0cd4e32f23
@ -65,8 +65,28 @@ public class Dev : SemanticPersona, IDevelopCode
|
|||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<string> BuildUnderstanding(string content)
|
public async Task<UnderstandingResult> BuildUnderstanding(string content)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
var explainFunction = _kernel.CreateSemanticFunction(Developer.Explain, new OpenAIRequestSettings { MaxTokens = 15000, Temperature = 0.8, TopP = 1 });
|
||||||
|
var consolidateFunction = _kernel.CreateSemanticFunction(Developer.ConsolidateUnderstanding, new OpenAIRequestSettings { MaxTokens = 15000, Temperature = 0.8, TopP = 1 });
|
||||||
|
var explainContext = new ContextVariables();
|
||||||
|
explainContext.Set("input", content);
|
||||||
|
var explainResult = await _kernel.RunAsync(explainContext, explainFunction);
|
||||||
|
var explainMesage = explainResult.ToString();
|
||||||
|
|
||||||
|
var consolidateContext = new ContextVariables();
|
||||||
|
consolidateContext.Set("input", _state.State.Understanding);
|
||||||
|
consolidateContext.Set("newUnderstanding", explainMesage);
|
||||||
|
|
||||||
|
var consolidateResult = await _kernel.RunAsync(consolidateContext, consolidateFunction);
|
||||||
|
var consolidateMessage = consolidateResult.ToString();
|
||||||
|
|
||||||
|
_state.State.Understanding = consolidateMessage;
|
||||||
|
await _state.WriteStateAsync();
|
||||||
|
|
||||||
|
return new UnderstandingResult {
|
||||||
|
NewUnderstanding = consolidateMessage,
|
||||||
|
Explanation = explainMesage
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -34,6 +34,7 @@ public class Ingester : SemanticPersona, IIngestRepo
|
|||||||
codeAnalysis.ToList().ForEach(async c =>
|
codeAnalysis.ToList().ForEach(async c =>
|
||||||
await _memory.SaveInformationAsync(MemorySegment, c.CodeBlock, Guid.NewGuid().ToString(), c.Meaning));
|
await _memory.SaveInformationAsync(MemorySegment, c.CodeBlock, Guid.NewGuid().ToString(), c.Meaning));
|
||||||
|
|
||||||
|
// TODO: do something with the result
|
||||||
await dev.BuildUnderstanding(file.Content);
|
await dev.BuildUnderstanding(file.Content);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,9 +41,16 @@ public interface IChatHistory
|
|||||||
|
|
||||||
public interface IUnderstand
|
public interface IUnderstand
|
||||||
{
|
{
|
||||||
Task<string> BuildUnderstanding(string content);
|
Task<UnderstandingResult> BuildUnderstanding(string content);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[GenerateSerializer]
|
||||||
|
public class UnderstandingResult {
|
||||||
|
[Id(0)]
|
||||||
|
public string NewUnderstanding { get; set; }
|
||||||
|
[Id(1)]
|
||||||
|
public string Explanation { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
[Serializable]
|
[Serializable]
|
||||||
public class ChatHistoryItem
|
public class ChatHistoryItem
|
||||||
|
Loading…
x
Reference in New Issue
Block a user