pub struct ResearchContext {
pub topic: String,
pub phase: ResearchPhase,
pub collected_info: Vec<InfoPiece>,
pub visited_urls: Vec<String>,
pub search_history: Vec<SearchHistory>,
pub citations: Vec<Citation>,
pub state: HashMap<String, Value>,
}Expand description
研究上下文
贯穿整个研究流程的共享状态。
Fields§
§topic: String研究主题
phase: ResearchPhase当前阶段
collected_info: Vec<InfoPiece>已收集的信息片段
visited_urls: Vec<String>已访问的 URL
search_history: Vec<SearchHistory>搜索历史
citations: Vec<Citation>引用列表
state: HashMap<String, Value>内部状态(用于策略特定数据)
Implementations§
Source§impl ResearchContext
impl ResearchContext
pub fn new(topic: &str) -> Self
pub fn add_info(&mut self, info: InfoPiece)
pub fn add_citation(&mut self, citation: Citation)
pub fn has_visited(&self, url: &str) -> bool
pub fn visit_url(&mut self, url: String)
pub fn set_phase(&mut self, phase: ResearchPhase)
pub fn add_search_history(&mut self, query: String, result_count: usize)
pub fn set_state(&mut self, key: &str, value: Value)
pub fn get_state(&self, key: &str) -> Option<&Value>
Sourcepub fn total_content_length(&self) -> usize
pub fn total_content_length(&self) -> usize
收集的信息总字符数
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ResearchContext
impl RefUnwindSafe for ResearchContext
impl Send for ResearchContext
impl Sync for ResearchContext
impl Unpin for ResearchContext
impl UnsafeUnpin for ResearchContext
impl UnwindSafe for ResearchContext
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more