replace OpenAIRequest with more generalized Box<dyn CompletionRequest>
This commit is contained in:
parent
05ae978cb7
commit
d813ae8845
6 changed files with 58 additions and 23 deletions
|
@ -1,11 +1,13 @@
|
|||
use anyhow::Result;
|
||||
use futures::{future::BoxFuture, stream::BoxStream};
|
||||
|
||||
use crate::providers::open_ai::completion::OpenAIRequest;
|
||||
pub trait CompletionRequest: Send + Sync {
|
||||
fn data(&self) -> serde_json::Result<String>;
|
||||
}
|
||||
|
||||
pub trait CompletionProvider {
|
||||
fn complete(
|
||||
&self,
|
||||
prompt: OpenAIRequest,
|
||||
prompt: Box<dyn CompletionRequest>,
|
||||
) -> BoxFuture<'static, Result<BoxStream<'static, Result<String>>>>;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue