Skip to content

Commit

Permalink
fix: change visiblity of internal functions
Browse files Browse the repository at this point in the history
  • Loading branch information
McPatate committed Feb 12, 2024
1 parent 8926969 commit 86043ce
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
10 changes: 7 additions & 3 deletions crates/llm-ls/src/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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()),
Expand All @@ -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),
Expand Down
4 changes: 2 additions & 2 deletions crates/llm-ls/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 86043ce

Please sign in to comment.