use crate::GraphQLResponse;
use crate::ProviderError;
use crate::graphql::mock_response_prompt::MockResponsePrompt;
use crate::llm_provider::http::gemini::GeminiCompatibleHttpProvider;
use crate::llm_provider::http::github_copilot::GithubCopilotHttpProvider;
use reqwest::Client;
use std::env;
pub mod gemini;
pub mod github_copilot;
#[derive(Debug, Clone)]
pub enum HttpProvider {
GithubCopilot(GithubCopilotHttpProvider),
Gemini(GeminiCompatibleHttpProvider),
}
impl HttpProvider {
pub(crate) async fn run(
&self,
prompt: &MockResponsePrompt,
client: &Client,
) -> Result<GraphQLResponse, ProviderError> {
if env::var("MOCKQL_DEBUG").is_ok()
&& let Ok(markdown) = prompt.to_markdown()
{
let _ = std::fs::write("prompt.dbg.txt", markdown);
}
match self {
Self::GithubCopilot(github_copilot) => github_copilot.run(prompt, client).await,
Self::Gemini(gemini) => gemini.run(prompt, client).await,
}
}
}