mirror of
https://github.com/katanemo/plano.git
synced 2026-06-23 15:38:07 +02:00
updating the implementation of /v1/chat/completions to use the generic provider interfaces
This commit is contained in:
parent
93ff4d7b1f
commit
203fc8f9a9
8 changed files with 441 additions and 89 deletions
|
|
@ -177,6 +177,18 @@ impl Display for LlmProviderType {
|
|||
}
|
||||
}
|
||||
|
||||
impl LlmProviderType {
|
||||
/// Create a ProviderInstance from this LlmProviderType
|
||||
/// This is the main method for stream_context to get provider-specific interfaces
|
||||
pub fn create_provider_instance(&self) -> hermesllm::ProviderInstance {
|
||||
use hermesllm::ProviderInstance;
|
||||
|
||||
// For now, all providers use OpenAI-compatible APIs
|
||||
// TODO: Return specific provider instances when implementing different APIs
|
||||
ProviderInstance::from_name(&self.to_string())
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
pub struct ModelUsagePreference {
|
||||
pub model: String,
|
||||
|
|
@ -252,6 +264,14 @@ impl Display for LlmProvider {
|
|||
}
|
||||
}
|
||||
|
||||
impl LlmProvider {
|
||||
/// Create a ProviderInstance for this LlmProvider
|
||||
/// This is a convenience method that delegates to the provider_interface
|
||||
pub fn create_provider_instance(&self) -> hermesllm::ProviderInstance {
|
||||
self.provider_interface.create_provider_instance()
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct Endpoint {
|
||||
pub endpoint: Option<String>,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue