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 public Document() { 039 } 040 041 public Document(String content) { 042 this.content = content; 043 } 044 045 public Object getId() { 046 return id; 047 } 048 049 public void setId(Object id) { 050 this.id = id; 051 } 052 053 public String getTitle() { 054 return title; 055 } 056 057 public void setTitle(String title) { 058 this.title = title; 059 } 060 061 public String getContent() { 062 return content; 063 } 064 065 public void setContent(String content) { 066 this.content = content; 067 } 068 069 public static Document of(String content) { 070 Document document = new Document(); 071 document.setContent(content); 072 return document; 073 } 074 075 @Override 076 public String toString() { 077 return "Document{" + 078 "id=" + id + 079 ", title='" + title + '\'' + 080 ", content='" + content + '\'' + 081// ", vector=" + Arrays.toString(vector) + 082 ", score=" + score + 083 ", metadataMap=" + metadataMap + 084 '}'; 085 } 086}