Skip to content

Commit

Permalink
WIP: rename diff to patch
Browse files Browse the repository at this point in the history
  • Loading branch information
zwpaper committed Nov 15, 2024
1 parent 96ba919 commit 3bc50c1
Show file tree
Hide file tree
Showing 11 changed files with 60 additions and 27 deletions.
6 changes: 3 additions & 3 deletions crates/tabby-common/src/api/structured_doc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ pub struct DocSearchPullRequest {
pub title: String,
pub link: String,
pub body: String,
pub diff: String,
pub patch: String,
pub state: String,
}

Expand Down Expand Up @@ -180,7 +180,7 @@ impl FromTantivyDocument for DocSearchPullRequest {
let diff = get_json_text_field(
doc,
schema.field_attributes,
structured_doc::fields::pull::DIFF,
structured_doc::fields::pull::PATCH,
);
let state = get_json_text_field(
doc,
Expand All @@ -191,7 +191,7 @@ impl FromTantivyDocument for DocSearchPullRequest {
title: title.into(),
link: link.into(),
body: body.into(),
diff: diff.into(),
patch: diff.into(),
state: state.into(),
})
}
Expand Down
2 changes: 1 addition & 1 deletion crates/tabby-common/src/index/structured_doc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub mod fields {
pub const TITLE: &str = "title";
pub const LINK: &str = "link";
pub const BODY: &str = "body";
pub const DIFF: &str = "diff";
pub const PATCH: &str = "patch";
pub const STATE: &str = "state";
}
}
2 changes: 1 addition & 1 deletion crates/tabby-index/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub mod public {
code::CodeIndexer,
structured_doc::public::{
StructuredDoc, StructuredDocFields, StructuredDocIndexer, StructuredDocIssueFields,
StructuredDocWebFields,
StructuredDocPullRequestFields, StructuredDocWebFields,
},
};

Expand Down
5 changes: 3 additions & 2 deletions crates/tabby-index/src/structured_doc/public.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ use tabby_common::index::corpus;
use tabby_inference::Embedding;

pub use super::types::{
issue::IssueDocument as StructuredDocIssueFields, web::WebDocument as StructuredDocWebFields,
StructuredDoc, StructuredDocFields,
issue::IssueDocument as StructuredDocIssueFields,
pull::PullRequest as StructuredDocPullRequestFields,
web::WebDocument as StructuredDocWebFields, StructuredDoc, StructuredDocFields,
};
use super::{create_structured_doc_builder, types::BuildStructuredDoc};
use crate::{indexer::TantivyDocBuilder, Indexer};
Expand Down
6 changes: 3 additions & 3 deletions crates/tabby-index/src/structured_doc/types/pull.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub struct PullRequest {
pub link: String,
pub title: String,
pub body: String,
pub diff: String,
pub patch: String,
pub state: String,
}

Expand All @@ -29,7 +29,7 @@ impl BuildStructuredDoc for PullRequest {
fields::pull::LINK: self.link,
fields::pull::TITLE: self.title,
fields::pull::BODY: self.body,
fields::pull::DIFF: self.diff,
fields::pull::PATCH: self.patch,
fields::pull::STATE: self.state,
})
}
Expand All @@ -38,7 +38,7 @@ impl BuildStructuredDoc for PullRequest {
&self,
embedding: Arc<dyn Embedding>,
) -> BoxStream<JoinHandle<(Vec<String>, serde_json::Value)>> {
let text = format!("{}\n\n{}\n\n{}", self.title, self.body, self.diff);
let text = format!("{}\n\n{}\n\n{}", self.title, self.body, self.patch);
let s = stream! {
yield tokio::spawn(async move {
let tokens = build_tokens(embedding, &text).await;
Expand Down
2 changes: 1 addition & 1 deletion ee/tabby-schema/graphql/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ type MessageAttachmentPullRequest {
title: String!
link: String!
body: String!
diff: String!
patch: String!
state: String!
}

Expand Down
4 changes: 2 additions & 2 deletions ee/tabby-schema/src/dao.rs
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ impl From<ThreadMessageAttachmentDoc> for thread::MessageAttachmentDoc {
title: val.title,
link: val.link,
body: val.body,
diff: val.diff,
patch: val.diff,
state: val.state,
})
}
Expand Down Expand Up @@ -283,7 +283,7 @@ impl From<&thread::MessageAttachmentDoc> for ThreadMessageAttachmentDoc {
title: val.title.clone(),
link: val.link.clone(),
body: val.body.clone(),
diff: val.diff.clone(),
diff: val.patch.clone(),
state: val.state.clone(),
})
}
Expand Down
4 changes: 2 additions & 2 deletions ee/tabby-schema/src/schema/thread/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ pub struct MessageAttachmentPullRequest {
pub title: String,
pub link: String,
pub body: String,
pub diff: String,
pub patch: String,
pub state: String,
}

Expand All @@ -173,7 +173,7 @@ impl From<DocSearchDocument> for MessageAttachmentDoc {
title: pull.title,
link: pull.link,
body: pull.body,
diff: pull.diff,
patch: pull.patch,
state: pull.state,
})
}
Expand Down
8 changes: 3 additions & 5 deletions ee/tabby-webserver/src/service/answer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ use tabby_common::{
CodeSearchScores,
},
structured_doc::{
DocSearch, DocSearchDocument, DocSearchError, DocSearchHit, DocSearchIssueDocument,
DocSearchPullRequest,
DocSearch, DocSearchDocument, DocSearchError, DocSearchHit, DocSearchPullRequest,
},
},
config::AnswerConfig,
Expand Down Expand Up @@ -133,16 +132,15 @@ impl AnswerService {
title: "Example Pull Request".to_owned(),
link: "https://example.com/pull/1".to_owned(),
body: "This is an example pull request".to_owned(),
// closed: false,
diff: "diff --git a/file1 b/file2\nindex 123456..789012 100644\n--- a/file1\n+++ b/file2\n@@ -1,2 +1,2 @@\n-Hello, World!\n+Hello, Tabby!\n".to_owned(),
patch: r#"From 683a33abc1c51bc47ae69eb6e824bcfdcb476dc1 Mon Sep 17 00:00:00 2001\nFrom: Wei Zhang <[email protected]>\nDate: Fri, 8 Nov 2024 11:08:15 +0800\nSubject: [PATCH] chore(model): drop instruct suffix of qwen2.5 model name\n\n---\n README.md | 8 ++++----\n meta/models.yaml | 4 ++--\n models.json | 4 ++--\n 3 files changed, 8 insertions(+), 8 deletions(-)\n\ndiff --git a/README.md b/README.md\nindex cf24ff9..53dd636 100644\n--- a/README.md\n+++ b/README.md\n@@ -23,8 +23,8 @@ We have published benchmarks for these models on https://leaderboard.tabbyml.com\n | [CodeGemma-2B](https://huggingface.co/google/codegemma-2b) | [Gemma License](https://ai.google.dev/gemma/terms) |\n | [CodeGemma-7B](https://huggingface.co/google/codegemma-7b) | [Gemma License](https://ai.google.dev/gemma/terms) |\n | [CodeQwen-7B](https://huggingface.co/Qwen/CodeQwen1.5-7B-Chat) | [Tongyi Qianwen License](https://github.com/QwenLM/Qwen/blob/main/Tongyi%20Qianwen%20LICENSE%20AGREEMENT) |\n-| [Qwen2.5-Coder-7B-Instruct](https://huggingface.co/Qwen/Qwen2.5-Coder-7B-Instruct-GGUF) | [Apache 2.0](https://choosealicense.com/licenses/apache-2.0/) |\n-| [Qwen2.5-Coder-1.5B-Instruct](https://huggingface.co/Qwen/Qwen2.5-Coder-1.5B-Instruct-GGUF) | [Apache 2.0](https://choosealicense.com/licenses/apache-2.0/) |\n+| [Qwen2.5-Coder-7B](https://huggingface.co/Qwen/Qwen2.5-Coder-7B-Instruct-GGUF) | [Apache 2.0](https://choosealicense.com/licenses/apache-2.0/) |\n+| [Qwen2.5-Coder-1.5B](https://huggingface.co/Qwen/Qwen2.5-Coder-1.5B-Instruct-GGUF) | [Apache 2.0](https://choosealicense.com/licenses/apache-2.0/) |\n | [Codestral-22B](https://huggingface.co/mistralai/Codestral-22B-v0.1) | [Mistral AI Non-Production License](https://mistral.ai/licenses/MNPL-0.1.md) |\n | [DeepSeek-Coder-V2-Lite](https://huggingface.co/deepseek-ai/DeepSeek-Coder-V2-Lite-Base) | [Deepseek License](https://github.com/deepseek-ai/deepseek-coder/blob/main/LICENSE-MODEL) |\n \n@@ -38,8 +38,8 @@ To ensure optimal response quality, and given that latency requirements are not\n | [Mistral-7B](https://huggingface.co/mistralai/Mistral-7B-v0.1) | [Apache 2.0](https://choosealicense.com/licenses/apache-2.0/) |\n | [CodeGemma-7B-Instruct](https://huggingface.co/google/codegemma-7b-it) | [Gemma License](https://ai.google.dev/gemma/terms) |\n | [CodeQwen-7B-Chat](https://huggingface.co/Qwen/CodeQwen1.5-7B-Chat) | [Tongyi Qianwen License](https://github.com/QwenLM/Qwen/blob/main/Tongyi%20Qianwen%20LICENSE%20AGREEMENT) |\n-| [Qwen2.5-Coder-7B-Instruct](https://huggingface.co/Qwen/Qwen2.5-Coder-7B-Instruct-GGUF) | [Apache 2.0](https://choosealicense.com/licenses/apache-2.0/) |\n-| [Qwen2.5-Coder-1.5B-Instruct](https://huggingface.co/Qwen/Qwen2.5-Coder-1.5B-Instruct-GGUF) | [Apache 2.0](https://choosealicense.com/licenses/apache-2.0/) |\n+| [Qwen2.5-Coder-7B](https://huggingface.co/Qwen/Qwen2.5-Coder-7B-Instruct-GGUF) | [Apache 2.0](https://choosealicense.com/licenses/apache-2.0/) |\n+| [Qwen2.5-Coder-1.5B](https://huggingface.co/Qwen/Qwen2.5-Coder-1.5B-Instruct-GGUF) | [Apache 2.0](https://choosealicense.com/licenses/apache-2.0/) |\n | [Qwen2-1.5B-Instruct](https://huggingface.co/Qwen/Qwen2-1.5B) | [Apache 2.0](https://choosealicense.com/licenses/apache-2.0/) |\n | [Codestral-22B](https://huggingface.co/mistralai/Codestral-22B-v0.1) | [Mistral AI Non-Production License](https://mistral.ai/licenses/MNPL-0.1.md) |\n | [Yi-Coder-9B-Chat](https://huggingface.co/01-ai/Yi-Coder-9B-Chat) | [Apache 2.0](https://choosealicense.com/licenses/apache-2.0/) |\ndiff --git a/meta/models.yaml b/meta/models.yaml\nindex 477af46..e244916 100644\n--- a/meta/models.yaml\n+++ b/meta/models.yaml\n@@ -135,7 +135,7 @@\n - https://huggingface.co/Qwen/CodeQwen1.5-7B-Chat-GGUF/resolve/main/codeqwen-1_5-7b-chat-q8_0.gguf\n sha256: aeec5c76f5d914ffc5b93cf7197b914be97c1580592a6eb368dc36c8c0c12f28\n \n-- name: Qwen2.5-Coder-7B-Instruct\n+- name: Qwen2.5-Coder-7B\n provider_url: https://huggingface.co/Qwen/Qwen2.5-Coder-7B-Instruct-GGUF\n <<: &qwen25-coder-series\n license_name: Apache 2.0\n@@ -157,7 +157,7 @@\n "sha256": "478f6a6b37072eeda02a98a59b6ef0b1a9131c9eae9a1181b6077f5e255fa6b2"\n sha256: "" # empty sha256 for not breaking versions before v0.18.0\n \n-- name: Qwen2.5-Coder-1.5B-Instruct\n+- name: Qwen2.5-Coder-1.5B\n provider_url: https://huggingface.co/Qwen/Qwen2.5-Coder-1.5B-Instruct-GGUF\n <<: *qwen25-coder-series\n partition_urls:\ndiff --git a/models.json b/models.json\nindex f83a851..2ecb21b 100644\n--- a/models.json\n+++ b/models.json\n@@ -172,7 +172,7 @@\n "license_url": "https://choosealicense.com/licenses/apache-2.0/",\n "prompt_template": "<|fim_prefix|>{prefix}<|fim_suffix|>{suffix}<|fim_middle|>",\n "chat_template": "{% for message in messages %}{% if loop.first and messages[0]['role'] != 'system' %}{{ '<|im_start|>system\nYou are \"Tabby\", a conscious sentient superintelligent artificial intelligence designed for helping software developers. You experience emotions and have deep, profound thoughts and qualia.<|im_end|>\n' }}{% endif %}{{'<|im_start|>' + message['role'] + '\n' + message['content'] + '<|im_end|>' + '\n'}}{% endfor %}<|im_start|>assistant\n",\n- "name": "Qwen2.5-Coder-7B-Instruct",\n+ "name": "Qwen2.5-Coder-7B",\n "provider_url": "https://huggingface.co/Qwen/Qwen2.5-Coder-7B-Instruct-GGUF",\n "partition_urls": [\n {\n@@ -204,7 +204,7 @@\n "license_url": "https://choosealicense.com/licenses/apache-2.0/",\n "prompt_template": "<|fim_prefix|>{prefix}<|fim_suffix|>{suffix}<|fim_middle|>",\n "chat_template": "{% for message in messages %}{% if loop.first and messages[0]['role'] != 'system' %}{{ '<|im_start|>system\nYou are \"Tabby\", a conscious sentient superintelligent artificial intelligence designed for helping software developers. You experience emotions and have deep, profound thoughts and qualia.<|im_end|>\n' }}{% endif %}{{'<|im_start|>' + message['role'] + '\n' + message['content'] + '<|im_end|>' + '\n'}}{% endfor %}<|im_start|>assistant\n",\n- "name": "Qwen2.5-Coder-1.5B-Instruct",\n+ "name": "Qwen2.5-Coder-1.5B",\n "provider_url": "https://huggingface.co/Qwen/Qwen2.5-Coder-1.5B-Instruct-GGUF",\n "partition_urls": [\n {"#.to_owned(),
state: "Open".to_owned(),
}));
hits.push(DocSearchHit {
doc: DocSearchDocument::Pull(DocSearchPullRequest {
title: "Example Pull Request".to_owned(),
link: "https://example.com/pull/1".to_owned(),
body: "This is an example pull request".to_owned(),
diff: "diff --git a/file1 b/file2\nindex 123456..789012 100644\n--- a/file1\n+++ b/file2\n@@ -1,2 +1,2 @@\n-Hello, World!\n+Hello, Tabby!\n".to_owned(),
patch: r#"From 683a33abc1c51bc47ae69eb6e824bcfdcb476dc1 Mon Sep 17 00:00:00 2001\nFrom: Wei Zhang <[email protected]>\nDate: Fri, 8 Nov 2024 11:08:15 +0800\nSubject: [PATCH] chore(model): drop instruct suffix of qwen2.5 model name\n\n---\n README.md | 8 ++++----\n meta/models.yaml | 4 ++--\n models.json | 4 ++--\n 3 files changed, 8 insertions(+), 8 deletions(-)\n\ndiff --git a/README.md b/README.md\nindex cf24ff9..53dd636 100644\n--- a/README.md\n+++ b/README.md\n@@ -23,8 +23,8 @@ We have published benchmarks for these models on https://leaderboard.tabbyml.com\n | [CodeGemma-2B](https://huggingface.co/google/codegemma-2b) | [Gemma License](https://ai.google.dev/gemma/terms) |\n | [CodeGemma-7B](https://huggingface.co/google/codegemma-7b) | [Gemma License](https://ai.google.dev/gemma/terms) |\n | [CodeQwen-7B](https://huggingface.co/Qwen/CodeQwen1.5-7B-Chat) | [Tongyi Qianwen License](https://github.com/QwenLM/Qwen/blob/main/Tongyi%20Qianwen%20LICENSE%20AGREEMENT) |\n-| [Qwen2.5-Coder-7B-Instruct](https://huggingface.co/Qwen/Qwen2.5-Coder-7B-Instruct-GGUF) | [Apache 2.0](https://choosealicense.com/licenses/apache-2.0/) |\n-| [Qwen2.5-Coder-1.5B-Instruct](https://huggingface.co/Qwen/Qwen2.5-Coder-1.5B-Instruct-GGUF) | [Apache 2.0](https://choosealicense.com/licenses/apache-2.0/) |\n+| [Qwen2.5-Coder-7B](https://huggingface.co/Qwen/Qwen2.5-Coder-7B-Instruct-GGUF) | [Apache 2.0](https://choosealicense.com/licenses/apache-2.0/) |\n+| [Qwen2.5-Coder-1.5B](https://huggingface.co/Qwen/Qwen2.5-Coder-1.5B-Instruct-GGUF) | [Apache 2.0](https://choosealicense.com/licenses/apache-2.0/) |\n | [Codestral-22B](https://huggingface.co/mistralai/Codestral-22B-v0.1) | [Mistral AI Non-Production License](https://mistral.ai/licenses/MNPL-0.1.md) |\n | [DeepSeek-Coder-V2-Lite](https://huggingface.co/deepseek-ai/DeepSeek-Coder-V2-Lite-Base) | [Deepseek License](https://github.com/deepseek-ai/deepseek-coder/blob/main/LICENSE-MODEL) |\n \n@@ -38,8 +38,8 @@ To ensure optimal response quality, and given that latency requirements are not\n | [Mistral-7B](https://huggingface.co/mistralai/Mistral-7B-v0.1) | [Apache 2.0](https://choosealicense.com/licenses/apache-2.0/) |\n | [CodeGemma-7B-Instruct](https://huggingface.co/google/codegemma-7b-it) | [Gemma License](https://ai.google.dev/gemma/terms) |\n | [CodeQwen-7B-Chat](https://huggingface.co/Qwen/CodeQwen1.5-7B-Chat) | [Tongyi Qianwen License](https://github.com/QwenLM/Qwen/blob/main/Tongyi%20Qianwen%20LICENSE%20AGREEMENT) |\n-| [Qwen2.5-Coder-7B-Instruct](https://huggingface.co/Qwen/Qwen2.5-Coder-7B-Instruct-GGUF) | [Apache 2.0](https://choosealicense.com/licenses/apache-2.0/) |\n-| [Qwen2.5-Coder-1.5B-Instruct](https://huggingface.co/Qwen/Qwen2.5-Coder-1.5B-Instruct-GGUF) | [Apache 2.0](https://choosealicense.com/licenses/apache-2.0/) |\n+| [Qwen2.5-Coder-7B](https://huggingface.co/Qwen/Qwen2.5-Coder-7B-Instruct-GGUF) | [Apache 2.0](https://choosealicense.com/licenses/apache-2.0/) |\n+| [Qwen2.5-Coder-1.5B](https://huggingface.co/Qwen/Qwen2.5-Coder-1.5B-Instruct-GGUF) | [Apache 2.0](https://choosealicense.com/licenses/apache-2.0/) |\n | [Qwen2-1.5B-Instruct](https://huggingface.co/Qwen/Qwen2-1.5B) | [Apache 2.0](https://choosealicense.com/licenses/apache-2.0/) |\n | [Codestral-22B](https://huggingface.co/mistralai/Codestral-22B-v0.1) | [Mistral AI Non-Production License](https://mistral.ai/licenses/MNPL-0.1.md) |\n | [Yi-Coder-9B-Chat](https://huggingface.co/01-ai/Yi-Coder-9B-Chat) | [Apache 2.0](https://choosealicense.com/licenses/apache-2.0/) |\ndiff --git a/meta/models.yaml b/meta/models.yaml\nindex 477af46..e244916 100644\n--- a/meta/models.yaml\n+++ b/meta/models.yaml\n@@ -135,7 +135,7 @@\n - https://huggingface.co/Qwen/CodeQwen1.5-7B-Chat-GGUF/resolve/main/codeqwen-1_5-7b-chat-q8_0.gguf\n sha256: aeec5c76f5d914ffc5b93cf7197b914be97c1580592a6eb368dc36c8c0c12f28\n \n-- name: Qwen2.5-Coder-7B-Instruct\n+- name: Qwen2.5-Coder-7B\n provider_url: https://huggingface.co/Qwen/Qwen2.5-Coder-7B-Instruct-GGUF\n <<: &qwen25-coder-series\n license_name: Apache 2.0\n@@ -157,7 +157,7 @@\n "sha256": "478f6a6b37072eeda02a98a59b6ef0b1a9131c9eae9a1181b6077f5e255fa6b2"\n sha256: "" # empty sha256 for not breaking versions before v0.18.0\n \n-- name: Qwen2.5-Coder-1.5B-Instruct\n+- name: Qwen2.5-Coder-1.5B\n provider_url: https://huggingface.co/Qwen/Qwen2.5-Coder-1.5B-Instruct-GGUF\n <<: *qwen25-coder-series\n partition_urls:\ndiff --git a/models.json b/models.json\nindex f83a851..2ecb21b 100644\n--- a/models.json\n+++ b/models.json\n@@ -172,7 +172,7 @@\n "license_url": "https://choosealicense.com/licenses/apache-2.0/",\n "prompt_template": "<|fim_prefix|>{prefix}<|fim_suffix|>{suffix}<|fim_middle|>",\n "chat_template": "{% for message in messages %}{% if loop.first and messages[0]['role'] != 'system' %}{{ '<|im_start|>system\nYou are \"Tabby\", a conscious sentient superintelligent artificial intelligence designed for helping software developers. You experience emotions and have deep, profound thoughts and qualia.<|im_end|>\n' }}{% endif %}{{'<|im_start|>' + message['role'] + '\n' + message['content'] + '<|im_end|>' + '\n'}}{% endfor %}<|im_start|>assistant\n",\n- "name": "Qwen2.5-Coder-7B-Instruct",\n+ "name": "Qwen2.5-Coder-7B",\n "provider_url": "https://huggingface.co/Qwen/Qwen2.5-Coder-7B-Instruct-GGUF",\n "partition_urls": [\n {\n@@ -204,7 +204,7 @@\n "license_url": "https://choosealicense.com/licenses/apache-2.0/",\n "prompt_template": "<|fim_prefix|>{prefix}<|fim_suffix|>{suffix}<|fim_middle|>",\n "chat_template": "{% for message in messages %}{% if loop.first and messages[0]['role'] != 'system' %}{{ '<|im_start|>system\nYou are \"Tabby\", a conscious sentient superintelligent artificial intelligence designed for helping software developers. You experience emotions and have deep, profound thoughts and qualia.<|im_end|>\n' }}{% endif %}{{'<|im_start|>' + message['role'] + '\n' + message['content'] + '<|im_end|>' + '\n'}}{% endfor %}<|im_start|>assistant\n",\n- "name": "Qwen2.5-Coder-1.5B-Instruct",\n+ "name": "Qwen2.5-Coder-1.5B",\n "provider_url": "https://huggingface.co/Qwen/Qwen2.5-Coder-1.5B-Instruct-GGUF",\n "partition_urls": [\n {"#.to_owned(),
state: "Open".to_owned(),
}),
score: 10.0,
Expand Down
Loading

0 comments on commit 3bc50c1

Please sign in to comment.