fix: change visiblity of internal functions
This commit is contained in:
parent
8926969265
commit
86043ce3af
|
@ -151,7 +151,7 @@ fn parse_openai_text(text: &str) -> Result<Vec<Generation>> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn build_body(
|
pub(crate) fn build_body(
|
||||||
backend: &Backend,
|
backend: &Backend,
|
||||||
model: String,
|
model: String,
|
||||||
prompt: String,
|
prompt: String,
|
||||||
|
@ -170,7 +170,11 @@ pub fn build_body(
|
||||||
request_body
|
request_body
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn build_headers(backend: &Backend, api_token: Option<&String>, ide: Ide) -> Result<HeaderMap> {
|
pub(crate) fn build_headers(
|
||||||
|
backend: &Backend,
|
||||||
|
api_token: Option<&String>,
|
||||||
|
ide: Ide,
|
||||||
|
) -> Result<HeaderMap> {
|
||||||
match backend {
|
match backend {
|
||||||
Backend::HuggingFace { .. } => build_api_headers(api_token, ide),
|
Backend::HuggingFace { .. } => build_api_headers(api_token, ide),
|
||||||
Backend::Ollama { .. } => Ok(build_ollama_headers()),
|
Backend::Ollama { .. } => Ok(build_ollama_headers()),
|
||||||
|
@ -179,7 +183,7 @@ pub fn build_headers(backend: &Backend, api_token: Option<&String>, ide: Ide) ->
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn parse_generations(backend: &Backend, text: &str) -> Result<Vec<Generation>> {
|
pub(crate) fn parse_generations(backend: &Backend, text: &str) -> Result<Vec<Generation>> {
|
||||||
match backend {
|
match backend {
|
||||||
Backend::HuggingFace { .. } => parse_api_text(text),
|
Backend::HuggingFace { .. } => parse_api_text(text),
|
||||||
Backend::Ollama { .. } => parse_ollama_text(text),
|
Backend::Ollama { .. } => parse_ollama_text(text),
|
||||||
|
|
|
@ -3,7 +3,7 @@ use std::fmt::Display;
|
||||||
use tower_lsp::jsonrpc::Error as LspError;
|
use tower_lsp::jsonrpc::Error as LspError;
|
||||||
use tracing::error;
|
use tracing::error;
|
||||||
|
|
||||||
pub fn internal_error<E: Display>(err: E) -> LspError {
|
pub(crate) fn internal_error<E: Display>(err: E) -> LspError {
|
||||||
let err_msg = err.to_string();
|
let err_msg = err.to_string();
|
||||||
error!(err_msg);
|
error!(err_msg);
|
||||||
LspError {
|
LspError {
|
||||||
|
@ -55,7 +55,7 @@ pub enum Error {
|
||||||
UnknownBackend(String),
|
UnknownBackend(String),
|
||||||
}
|
}
|
||||||
|
|
||||||
pub type Result<T> = std::result::Result<T, Error>;
|
pub(crate) type Result<T> = std::result::Result<T, Error>;
|
||||||
|
|
||||||
impl From<Error> for LspError {
|
impl From<Error> for LspError {
|
||||||
fn from(err: Error) -> Self {
|
fn from(err: Error) -> Self {
|
||||||
|
|
Loading…
Reference in a new issue