Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TextSynth support #1919

Merged
merged 3 commits into from
Oct 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading