Make WorkflowStepResolution an entity (#16268)

This PR is just a refactor, to pave the way toward adding a view for
workflow step resolution. The entity carries the state of the tool
call's streaming output.

Release Notes:

- N/A
This commit is contained in:
Max Brunsfeld 2024-08-14 22:44:44 -07:00 committed by GitHub
parent 102796979b
commit e0cabbd142
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 753 additions and 725 deletions

View file

@ -99,6 +99,16 @@ impl dyn LanguageModel {
Ok(serde_json::from_str(&response)?)
}
}
pub fn use_tool_stream<T: LanguageModelTool>(
&self,
request: LanguageModelRequest,
cx: &AsyncAppContext,
) -> BoxFuture<'static, Result<BoxStream<'static, Result<String>>>> {
let schema = schemars::schema_for!(T);
let schema_json = serde_json::to_value(&schema).unwrap();
self.use_any_tool(request, T::name(), T::description(), schema_json, cx)
}
}
pub trait LanguageModelTool: 'static + DeserializeOwned + JsonSchema {