Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Serialize Support for Further Stucts #36

Merged
merged 1 commit into from
Apr 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/generation/chat/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ impl Ollama {
}
}

#[derive(Debug, Clone, Deserialize)]
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct ChatMessageResponse {
/// The name of the model used for the completion.
pub model: String,
Expand All @@ -168,7 +168,7 @@ pub struct ChatMessageResponse {
pub final_data: Option<ChatMessageFinalResponseData>,
}

#[derive(Debug, Clone, Deserialize)]
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct ChatMessageFinalResponseData {
/// Time spent generating the response
pub total_duration: u64,
Expand Down
4 changes: 2 additions & 2 deletions src/generation/chat/request.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use serde::Serialize;
use serde::{Deserialize, Serialize};

use crate::generation::{options::GenerationOptions, parameters::FormatType};

use super::ChatMessage;

/// A chat message request to Ollama.
#[derive(Debug, Clone, Serialize)]
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ChatMessageRequest {
#[serde(rename = "model")]
pub model_name: String,
Expand Down
6 changes: 3 additions & 3 deletions src/models.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@ pub mod pull;
pub mod push;
pub mod show_info;

use serde::Deserialize;
use serde::{Deserialize, Serialize};

/// A local model pulled from Ollama.
#[derive(Debug, Clone, Deserialize)]
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct LocalModel {
pub name: String,
pub modified_at: String,
pub size: u64,
}

/// A model's info.
#[derive(Debug, Clone, Deserialize)]
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ModelInfo {
pub license: String,
pub modelfile: String,
Expand Down
Loading