Skip to content

Commit

Permalink
working textsynth (no chat)
Browse files Browse the repository at this point in the history
  • Loading branch information
spolu committed Oct 2, 2023
1 parent e731ecf commit 77406e8
Show file tree
Hide file tree
Showing 10 changed files with 776 additions and 2 deletions.
1 change: 1 addition & 0 deletions core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ pub mod providers {
pub mod tiktoken;
}
pub mod anthropic;
pub mod textsynth;
}
pub mod http {
pub mod request;
Expand Down
6 changes: 6 additions & 0 deletions core/src/providers/provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ use serde::{Deserialize, Serialize};
use std::str::FromStr;
use std::time::Duration;

use super::textsynth::TextSynthProvider;

#[derive(Debug, Clone, Copy, Serialize, PartialEq, Deserialize)]
#[serde(rename_all = "lowercase")]
pub enum ProviderID {
Expand All @@ -22,6 +24,7 @@ pub enum ProviderID {
#[serde(rename = "azure_openai")]
AzureOpenAI,
Anthropic,
TextSynth,
}

impl ToString for ProviderID {
Expand All @@ -32,6 +35,7 @@ impl ToString for ProviderID {
ProviderID::AI21 => String::from("ai21"),
ProviderID::AzureOpenAI => String::from("azure_openai"),
ProviderID::Anthropic => String::from("anthropic"),
ProviderID::TextSynth => String::from("textsynth"),
}
}
}
Expand All @@ -45,6 +49,7 @@ impl FromStr for ProviderID {
"ai21" => Ok(ProviderID::AI21),
"azure_openai" => Ok(ProviderID::AzureOpenAI),
"anthropic" => Ok(ProviderID::Anthropic),
"textsynth" => Ok(ProviderID::TextSynth),
_ => Err(ParseError::with_message(
"Unknown provider ID (possible values: openai, cohere, ai21, azure_openai)",
))?,
Expand Down Expand Up @@ -139,5 +144,6 @@ pub fn provider(t: ProviderID) -> Box<dyn Provider + Sync + Send> {
ProviderID::AI21 => Box::new(AI21Provider::new()),
ProviderID::AzureOpenAI => Box::new(AzureOpenAIProvider::new()),
ProviderID::Anthropic => Box::new(AnthropicProvider::new()),
ProviderID::TextSynth => Box::new(TextSynthProvider::new()),
}
}
Loading

0 comments on commit 77406e8

Please sign in to comment.