From dd3e6649ffecd175317ea2473c0df260c3a120a2 Mon Sep 17 00:00:00 2001 From: 0007 <0007@qq.com> Date: Wed, 27 Aug 2025 19:58:42 +0800 Subject: [PATCH] Add File --- .../agentsflex/core/document/Document.java | 100 ++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 agents-flex-core/src/main/java/com/agentsflex/core/document/Document.java diff --git a/agents-flex-core/src/main/java/com/agentsflex/core/document/Document.java b/agents-flex-core/src/main/java/com/agentsflex/core/document/Document.java new file mode 100644 index 0000000..cf62b0c --- /dev/null +++ b/agents-flex-core/src/main/java/com/agentsflex/core/document/Document.java @@ -0,0 +1,100 @@ +/* + * Copyright (c) 2023-2025, Agents-Flex (fuhai999@gmail.com). + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.agentsflex.core.document; + +import com.agentsflex.core.store.VectorData; + +public class Document extends VectorData { + + /** + * Document ID + */ + private Object id; + + /** + * Document title + */ + private String title; + + /** + * Document Content + */ + private String content; + + + /** + * 得分,目前只有在 rerank 场景使用 + */ + private Double score; + + + public Document() { + } + + public Document(String content) { + this.content = content; + } + + public Object getId() { + return id; + } + + public void setId(Object id) { + this.id = id; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public String getContent() { + return content; + } + + public void setContent(String content) { + this.content = content; + } + + @Override + public Double getScore() { + return score; + } + + @Override + public void setScore(Double score) { + this.score = score; + } + + public static Document of(String content){ + Document document = new Document(); + document.setContent(content); + return document; + } + + @Override + public String toString() { + return "Document{" + + "id=" + id + + ", title='" + title + '\'' + + ", content='" + content + '\'' + + ", score=" + score + + '}'; + } +}