001/*
002 *  Copyright (c) 2023-2026, Agents-Flex (fuhai999@gmail.com).
003 *  <p>
004 *  Licensed under the Apache License, Version 2.0 (the "License");
005 *  you may not use this file except in compliance with the License.
006 *  You may obtain a copy of the License at
007 *  <p>
008 *  http://www.apache.org/licenses/LICENSE-2.0
009 *  <p>
010 *  Unless required by applicable law or agreed to in writing, software
011 *  distributed under the License is distributed on an "AS IS" BASIS,
012 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 *  See the License for the specific language governing permissions and
014 *  limitations under the License.
015 */
016package com.agentsflex.core.document;
017
018import com.agentsflex.core.store.VectorData;
019
020public class Document extends VectorData {
021
022    /**
023     * Document ID
024     */
025    private Object id;
026
027    /**
028     * Document title
029     */
030    private String title;
031
032    /**
033     * Document Content
034     */
035    private String content;
036
037
038    /**
039     * 得分,目前只有在 rerank 场景使用
040     */
041    private Double score;
042
043
044    public Document() {
045    }
046
047    public Document(String content) {
048        this.content = content;
049    }
050
051    public Object getId() {
052        return id;
053    }
054
055    public void setId(Object id) {
056        this.id = id;
057    }
058
059    public String getTitle() {
060        return title;
061    }
062
063    public void setTitle(String title) {
064        this.title = title;
065    }
066
067    public String getContent() {
068        return content;
069    }
070
071    public void setContent(String content) {
072        this.content = content;
073    }
074
075    @Override
076    public Double getScore() {
077        return score;
078    }
079
080    @Override
081    public void setScore(Double score) {
082        this.score = score;
083    }
084
085    public static Document of(String content){
086        Document document = new Document();
087        document.setContent(content);
088        return document;
089    }
090
091    @Override
092    public String toString() {
093        return "Document{" +
094            "id=" + id +
095            ", title='" + title + '\'' +
096            ", content='" + content + '\'' +
097            ", score=" + score +
098            '}';
099    }
100}