fix: change visiblity of internal functions

This commit is contained in:
Luc Georges 2024-02-12 15:58:56 +01:00
parent 8926969265
commit 86043ce3af
No known key found for this signature in database
GPG key ID: 22924A120A2C2CE0
2 changed files with 9 additions and 5 deletions

View file

@ -151,7 +151,7 @@ fn parse_openai_text(text: &str) -> Result<Vec<Generation>> {
}
}
pub fn build_body(
pub(crate) fn build_body(
backend: &Backend,
model: String,
prompt: String,
@ -170,7 +170,11 @@ pub fn build_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 {
Backend::HuggingFace { .. } => build_api_headers(api_token, ide),
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 {
Backend::HuggingFace { .. } => parse_api_text(text),
Backend::Ollama { .. } => parse_ollama_text(text),

View file

@ -3,7 +3,7 @@ use std::fmt::Display;
use tower_lsp::jsonrpc::Error as LspError;
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();
error!(err_msg);
LspError {
@ -55,7 +55,7 @@ pub enum Error {
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 {
fn from(err: Error) -> Self {