Skip to content

Commit

Permalink
Make use of History optional
Browse files Browse the repository at this point in the history
  • Loading branch information
ushinnary committed Mar 12, 2024
1 parent fc0e59b commit 35895a8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#[cfg(feature = "chat-history")]
use generation::chat::{ChatMessage, MessagesHistory};

pub mod error;
Expand Down Expand Up @@ -26,7 +27,6 @@ impl Ollama {
pub fn uri(&self) -> String {
format!("{}:{}", self.host, self.port)
}

}

#[cfg(feature = "chat-history")]
Expand All @@ -38,8 +38,8 @@ impl Ollama {
..Default::default()
}
}
/// Create new instance with chat history

/// Create new instance with chat history
pub fn new_with_history(host: String, port: u16, messages_number_limit: u16) -> Self {
Self {
host,
Expand All @@ -48,7 +48,7 @@ impl Ollama {
..Default::default()
}
}

/// Add AI's message to a history
pub fn add_assistant_response(&mut self, entry_id: String, message: String) {
if let Some(messages_history) = self.messages_history.as_mut() {
Expand Down

0 comments on commit 35895a8

Please sign in to comment.