added credential provider to completion provider
This commit is contained in:
parent
7af77b1cf9
commit
558f54c424
5 changed files with 22 additions and 9 deletions
|
@ -1,7 +1,11 @@
|
|||
use anyhow::Result;
|
||||
use futures::{future::BoxFuture, stream::BoxStream};
|
||||
use gpui::AppContext;
|
||||
|
||||
use crate::models::LanguageModel;
|
||||
use crate::{
|
||||
auth::{CredentialProvider, ProviderCredential},
|
||||
models::LanguageModel,
|
||||
};
|
||||
|
||||
pub trait CompletionRequest: Send + Sync {
|
||||
fn data(&self) -> serde_json::Result<String>;
|
||||
|
@ -9,6 +13,10 @@ pub trait CompletionRequest: Send + Sync {
|
|||
|
||||
pub trait CompletionProvider {
|
||||
fn base_model(&self) -> Box<dyn LanguageModel>;
|
||||
fn credential_provider(&self) -> Box<dyn CredentialProvider>;
|
||||
fn retrieve_credentials(&self, cx: &AppContext) -> ProviderCredential {
|
||||
self.credential_provider().retrieve_credentials(cx)
|
||||
}
|
||||
fn complete(
|
||||
&self,
|
||||
prompt: Box<dyn CompletionRequest>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue