国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

Spring AI - 使用向量數(shù)據(jù)庫實(shí)現(xiàn)檢索式AI對(duì)話

這篇具有很好參考價(jià)值的文章主要介紹了Spring AI - 使用向量數(shù)據(jù)庫實(shí)現(xiàn)檢索式AI對(duì)話。希望對(duì)大家有所幫助。如果存在錯(cuò)誤或未考慮完全的地方,請(qǐng)大家不吝賜教,您也可以點(diǎn)擊"舉報(bào)違法"按鈕提交疑問。

Spring AI - 使用向量數(shù)據(jù)庫實(shí)現(xiàn)檢索式AI對(duì)話

?Spring AI 并不僅限于針對(duì)大語言模型對(duì)話API進(jìn)行了統(tǒng)一封裝,它還可以通過簡(jiǎn)單的方式實(shí)現(xiàn)LangChain的一些功能。本篇將帶領(lǐng)讀者實(shí)現(xiàn)一個(gè)簡(jiǎn)單的檢索式AI對(duì)話接口。

一、需求背景

?在一些場(chǎng)景下,我們想讓AI根據(jù)我們提供的數(shù)據(jù)進(jìn)行回復(fù)。因?yàn)閷?duì)話有最大Token的限制,因此很多場(chǎng)景下我們是無法直接將所有的數(shù)據(jù)發(fā)給AI的,一方面在數(shù)據(jù)量很大的情況下,會(huì)突破Token的限制,另一方面,在不突破Token限制的情況下也會(huì)有不必要的對(duì)話費(fèi)用開銷。因此我們?nèi)绾卧诨ㄙM(fèi)最少費(fèi)用的同時(shí)又能讓AI更好的根據(jù)我們提供的數(shù)據(jù)進(jìn)行回復(fù)是一個(gè)非常關(guān)鍵的問題。針對(duì)這一問題,我們可以采用數(shù)據(jù)向量化的方式來解決。

二、實(shí)現(xiàn)原理

將我們個(gè)人數(shù)據(jù)存儲(chǔ)到向量數(shù)據(jù)庫中。然后,在用戶想AI發(fā)起對(duì)話之前,首先從向量數(shù)據(jù)庫中檢索一組相似的文檔。然后,將這些文檔作為用戶問題的上下文,并與用戶的對(duì)話一起發(fā)送到 AI 模型,從而實(shí)現(xiàn)精確性的回復(fù)。這種方式稱為檢索增強(qiáng)生成(RAG)。

第一步:數(shù)據(jù)向量化

?我們有很多種方式將數(shù)據(jù)向量化,最簡(jiǎn)單的就是通過調(diào)用第三方API來實(shí)現(xiàn)。以O(shè)penAI的API為例,它提供了 https://api.openai.com/v1/embeddings 接口,通過請(qǐng)求該接口可以獲取某段文本的向量化的數(shù)據(jù)。具體可參考官方API介紹:Create embeddings。在Spring AI中,我們不必調(diào)用該接口手動(dòng)進(jìn)行向量化處理,在存儲(chǔ)到向量數(shù)據(jù)庫的時(shí)候,Spring AI會(huì)自動(dòng)調(diào)用的。

spring-ai,GitHub開源項(xiàng)目,Spring,ChatGPT,spring,人工智能,數(shù)據(jù)庫

第二步:向量存儲(chǔ)及檢索

?在Spring AI中有一個(gè)VectorStore抽象接口,該接口定義了Spring AI與向量數(shù)據(jù)庫的交互操作,我們只需通過簡(jiǎn)單的向量數(shù)據(jù)庫的配置即可使用該接口對(duì)向量數(shù)據(jù)庫進(jìn)行操作。

public interface VectorStore {

    void add(List<Document> documents);

    Optional<Boolean> delete(List<String> idList);

    List<Document> similaritySearch(String query);

    List<Document> similaritySearch(SearchRequest request);
}

?向量數(shù)據(jù)庫(Vector Database)是一種特殊類型的數(shù)據(jù)庫,在人工智能應(yīng)用中發(fā)揮著重要作用。在向量數(shù)據(jù)庫中,查詢操作與傳統(tǒng)的關(guān)系數(shù)據(jù)庫不同。它們是執(zhí)行相似性搜索,而不是精確匹配。當(dāng)給定向量作為查詢時(shí),向量數(shù)據(jù)庫返回與查詢向量“相似”的向量。通過這種方式,我們就能將個(gè)人的數(shù)據(jù)與AI模型進(jìn)行集成。`

?常見的向量數(shù)據(jù)庫有:Chroma、Milvus、PgvectorRedis、Neo4j等。

三、代碼實(shí)現(xiàn)

?本篇將實(shí)現(xiàn)基于ChatGPT的RAG和上傳PDF文件存儲(chǔ)至向量數(shù)據(jù)庫的接口,向量數(shù)據(jù)庫使用Pgvector。Pgvector是基于PostgreSQL進(jìn)行的擴(kuò)展,可以存儲(chǔ)和檢索機(jī)器學(xué)習(xí)過程中生成的embeddings。

源碼已上傳至GitHub: https://github.com/NingNing0111/vector-database-demo

版本信息

  • JDK >= 17
  • Spring Boot >= 3.2.2
  • Spring AI = 0.8.0-SNAPSHOT

1. 安裝Pgvector

?Pgvector將使用Docker安裝。docker-compose.yml文件如下:

version: '3.7'
services:
  postgres:
    image: ankane/pgvector:v0.5.0
    restart: always
    environment:
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=postgres
      - POSTGRES_DB=vector_store
      - PGPASSWORD=postgres
    logging:
      options:
        max-size: 10m
        max-file: "3"
    ports:
      - '5432:5432'
    healthcheck:
      test: "pg_isready -U postgres -d vector_store"
      interval: 2s
      timeout: 20s
      retries: 10

2. 創(chuàng)建Spring項(xiàng)目,添加依賴

?Spring 項(xiàng)目的創(chuàng)建過程略,pom.xml核心內(nèi)容如下:

	<properties>
		<java.version>17</java.version>
        <!--  Spring AI的版本信息  -->
		<spring-ai.version>0.8.0-SNAPSHOT</spring-ai.version>
	</properties>

	<dependencies>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-jdbc</artifactId>
		</dependency>

		<!-- 使用OpenAI -->
		<dependency>
			<groupId>org.springframework.ai</groupId>
			<artifactId>spring-ai-openai-spring-boot-starter</artifactId>
			<version>${spring-ai.version}</version>
		</dependency>
		<!-- 使用PGVector作為向量數(shù)據(jù)庫 -->
		<dependency>
			<groupId>org.springframework.ai</groupId>
			<artifactId>spring-ai-pgvector-store-spring-boot-starter</artifactId>
			<version>${spring-ai.version}</version>
		</dependency>
		<!-- 引入PDF解析器 -->
		<dependency>
			<groupId>org.springframework.ai</groupId>
			<artifactId>spring-ai-pdf-document-reader</artifactId>
			<version>${spring-ai.version}</version>
		</dependency>
	</dependencies>

	<repositories>
		<repository>
			<id>spring-milestones</id>
			<name>Spring Milestones</name>
			<url>https://repo.spring.io/milestone</url>
			<snapshots>
				<enabled>false</enabled>
			</snapshots>
		</repository>
		<repository>
			<id>spring-snapshots</id>
			<name>Spring Snapshots</name>
			<url>https://repo.spring.io/snapshot</url>
			<releases>
				<enabled>false</enabled>
			</releases>
		</repository>
	</repositories>

3. 配置API、Key、PGVector連接信息

server:
  port: 8801

spring:
  ai:
    openai:
      base-url: https://api.example.com
      api-key: sk-aec103e6cfxxxxxxxxxxxxxxxxxxxxxxx71da57a

  datasource:
    username: postgres
    password: postgres
    url: jdbc:postgresql://localhost/vector_store

4. 創(chuàng)建VectorStore和文本分割器TokenTextSplitter

?這里我創(chuàng)建了一個(gè)ApplicationConfig配置類

package com.ningning0111.vectordatabasedemo.config;

import org.springframework.ai.embedding.EmbeddingClient;
import org.springframework.ai.transformer.splitter.TokenTextSplitter;
import org.springframework.ai.vectorstore.PgVectorStore;
import org.springframework.ai.vectorstore.VectorStore;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.jdbc.core.JdbcTemplate;

@Configuration
public class ApplicationConfig {

    /**
     * 向量數(shù)據(jù)庫進(jìn)行檢索操作
     * @param embeddingClient
     * @param jdbcTemplate
     * @return
     */
    @Bean
    public VectorStore vectorStore(EmbeddingClient embeddingClient, JdbcTemplate jdbcTemplate){
        return new PgVectorStore(jdbcTemplate,embeddingClient);
    }

    /**
     * 文本分割器
     * @return
     */
    @Bean
    public TokenTextSplitter tokenTextSplitter() {
        return new TokenTextSplitter();
    }
}

5. 構(gòu)建PDF存儲(chǔ)服務(wù)層

?在service層下創(chuàng)建一個(gè)名為PdfStoreService的類,用于將PDF文件存儲(chǔ)到向量數(shù)據(jù)庫中。

package com.ningning0111.vectordatabasedemo.service;

import lombok.RequiredArgsConstructor;
import org.springframework.ai.reader.ExtractedTextFormatter;
import org.springframework.ai.reader.pdf.PagePdfDocumentReader;
import org.springframework.ai.reader.pdf.ParagraphPdfDocumentReader;
import org.springframework.ai.reader.pdf.config.PdfDocumentReaderConfig;
import org.springframework.ai.transformer.splitter.TokenTextSplitter;
import org.springframework.ai.vectorstore.VectorStore;
import org.springframework.core.io.DefaultResourceLoader;
import org.springframework.core.io.FileSystemResource;
import org.springframework.core.io.Resource;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;

@Service
@RequiredArgsConstructor
public class PdfStoreService {

    private final DefaultResourceLoader resourceLoader;
    private final VectorStore vectorStore;
    private final TokenTextSplitter tokenTextSplitter;

    /**
     * 根據(jù)PDF的頁數(shù)進(jìn)行分割
     * @param url
     */
    public void saveSourceByPage(String url){
        // 加載資源,需要本地路徑的信息
        Resource resource = resourceLoader.getResource(url);
        // 加載PDF文件時(shí)的配置對(duì)象
        PdfDocumentReaderConfig loadConfig = PdfDocumentReaderConfig.builder()
                .withPageExtractedTextFormatter(
                        new ExtractedTextFormatter
                                .Builder()
                                .withNumberOfBottomTextLinesToDelete(3)
                                .withNumberOfTopPagesToSkipBeforeDelete(1)
                                .build()
                )
                .withPagesPerDocument(1)
                .build();

        PagePdfDocumentReader pagePdfDocumentReader = new PagePdfDocumentReader(resource, loadConfig);
        // 存儲(chǔ)到向量數(shù)據(jù)庫中
        vectorStore.accept(tokenTextSplitter.apply(pagePdfDocumentReader.get()));
    }

    /**
     * 根據(jù)PDF的目錄(段落)進(jìn)行劃分
     * @param url
     */
    public void saveSourceByParagraph(String url){
        Resource resource = resourceLoader.getResource(url);

        PdfDocumentReaderConfig loadConfig = PdfDocumentReaderConfig.builder()
                .withPageExtractedTextFormatter(
                        new ExtractedTextFormatter
                                .Builder()
                                .withNumberOfBottomTextLinesToDelete(3)
                                .withNumberOfTopPagesToSkipBeforeDelete(1)
                                .build()
                )
                .withPagesPerDocument(1)
                .build();

        ParagraphPdfDocumentReader pdfReader = new ParagraphPdfDocumentReader(
                resource,
                loadConfig
        );
        vectorStore.accept(tokenTextSplitter.apply(pdfReader.get()));
    }

    /**
     * MultipartFile對(duì)象存儲(chǔ),采用PagePdfDocumentReader
     * @param file
     */
    public void saveSource(MultipartFile file){
        try {
            // 獲取文件名
            String fileName = file.getOriginalFilename();
            // 獲取文件內(nèi)容類型
            String contentType = file.getContentType();
            // 獲取文件字節(jié)數(shù)組
            byte[] bytes = file.getBytes();
            // 創(chuàng)建一個(gè)臨時(shí)文件
            Path tempFile = Files.createTempFile("temp-", fileName);
            // 將文件字節(jié)數(shù)組保存到臨時(shí)文件
            Files.write(tempFile, bytes);
            // 創(chuàng)建一個(gè) FileSystemResource 對(duì)象
            Resource fileResource = new FileSystemResource(tempFile.toFile());
            PdfDocumentReaderConfig loadConfig = PdfDocumentReaderConfig.builder()
                    .withPageExtractedTextFormatter(
                            new ExtractedTextFormatter
                                    .Builder()
                                    .withNumberOfBottomTextLinesToDelete(3)
                                    .withNumberOfTopPagesToSkipBeforeDelete(1)
                                    .build()
                    )
                    .withPagesPerDocument(1)
                    .build();
            PagePdfDocumentReader pagePdfDocumentReader = new PagePdfDocumentReader(fileResource, loadConfig);
            vectorStore.accept(tokenTextSplitter.apply(pagePdfDocumentReader.get()));
        }catch (IOException e){
            e.printStackTrace();
        }

    }
}

6. 構(gòu)建對(duì)話服務(wù)

?創(chuàng)建ChatService類,該類提供了兩種對(duì)話方式:不進(jìn)行檢索的普通對(duì)話模式對(duì)向量數(shù)據(jù)庫進(jìn)行檢索的對(duì)話模式

package com.ningning0111.vectordatabasedemo.service;

import lombok.RequiredArgsConstructor;
import org.springframework.ai.chat.ChatClient;
import org.springframework.ai.chat.ChatResponse;
import org.springframework.ai.chat.messages.Message;
import org.springframework.ai.chat.messages.UserMessage;
import org.springframework.ai.chat.prompt.Prompt;
import org.springframework.ai.chat.prompt.SystemPromptTemplate;
import org.springframework.ai.document.Document;
import org.springframework.ai.vectorstore.VectorStore;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

@Service
@RequiredArgsConstructor
public class ChatService {

    // 系統(tǒng)提示詞
    private final static String SYSTEM_PROMPT = """
            你需要使用文檔內(nèi)容對(duì)用戶提出的問題進(jìn)行回復(fù),同時(shí)你需要表現(xiàn)得天生就知道這些內(nèi)容,
            不能在回復(fù)中體現(xiàn)出你是根據(jù)給出的文檔內(nèi)容進(jìn)行回復(fù)的,這點(diǎn)非常重要。
            
            當(dāng)用戶提出的問題無法根據(jù)文檔內(nèi)容進(jìn)行回復(fù)或者你也不清楚時(shí),回復(fù)不知道即可。
                    
            文檔內(nèi)容如下:
            {documents}
            
            """;

    private final ChatClient chatClient;
    private final VectorStore vectorStore;

    // 簡(jiǎn)單的對(duì)話,不對(duì)向量數(shù)據(jù)庫進(jìn)行檢索
    public String simpleChat(String userMessage) {
        return chatClient.call(userMessage);
    }

    // 通過向量數(shù)據(jù)庫進(jìn)行檢索
    public String chatByVectorStore(String message) {
        // 根據(jù)問題文本進(jìn)行相似性搜索
        List<Document> listOfSimilarDocuments = vectorStore.similaritySearch(message);
        // 將Document列表中每個(gè)元素的content內(nèi)容進(jìn)行拼接獲得documents
        String documents = listOfSimilarDocuments.stream().map(Document::getContent).collect(Collectors.joining());
        // 使用Spring AI 提供的模板方式構(gòu)建SystemMessage對(duì)象
        Message systemMessage = new SystemPromptTemplate(SYSTEM_PROMPT).createMessage(Map.of("documents", documents));
        // 構(gòu)建UserMessage對(duì)象
        UserMessage userMessage = new UserMessage(message);
        // 將Message列表一并發(fā)送給ChatGPT
        ChatResponse rsp = chatClient.call(new Prompt(List.of(systemMessage, userMessage)));
        return rsp.getResult().getOutput().getContent();
    }
}

7. 構(gòu)建Controller層

?ChatController提供了對(duì)話接口:

package com.ningning0111.vectordatabasedemo.controller;

import com.ningning0111.vectordatabasedemo.service.ChatService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequiredArgsConstructor
@RequestMapping("/api/v1/chat")
public class ChatController {

    private final ChatService chatService;

    @GetMapping("/simple")
    public String simpleChat(
            @RequestParam String message
    ){
        return chatService.simpleChat(message);
    }

    @GetMapping("/")
    public String chat(
            @RequestParam String message
    ){
        return chatService.chatByVectorStore(message);
    }
}

?PdfUploadController提供了上傳文件并保存到向量數(shù)據(jù)庫中的接口

package com.ningning0111.vectordatabasedemo.controller;

import com.ningning0111.vectordatabasedemo.service.PdfStoreService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile;

@Controller
@RequestMapping("/api/v1/pdf")
@RequiredArgsConstructor
public class PdfUploadController {
    private final PdfStoreService pdfStoreService;

    @PostMapping("/upload")
    public void upload(
            @RequestParam MultipartFile file
    ){
        pdfStoreService.saveSource(file);
    }
}

三、效果圖

?以24年合工大軟工實(shí)訓(xùn)的pdf文件為例,通過向chatgpt提問與文檔內(nèi)容相關(guān)的問題。

?詢問:2024年合工大軟件工程實(shí)訓(xùn)中較難的項(xiàng)目有哪些?
spring-ai,GitHub開源項(xiàng)目,Spring,ChatGPT,spring,人工智能,數(shù)據(jù)庫
?詢問:介紹下2024年合工大軟件工程實(shí)訓(xùn)中知識(shí)內(nèi)容共享平臺(tái)的需求
spring-ai,GitHub開源項(xiàng)目,Spring,ChatGPT,spring,人工智能,數(shù)據(jù)庫
?詢問:針對(duì)運(yùn)營(yíng)商云管平臺(tái)工單處理子模塊項(xiàng)目簡(jiǎn)介,給出這個(gè)項(xiàng)目的實(shí)現(xiàn)方案或技術(shù)棧
spring-ai,GitHub開源項(xiàng)目,Spring,ChatGPT,spring,人工智能,數(shù)據(jù)庫

源碼已上傳至GitHub:https://github.com/NingNing0111/vector-database-demo文章來源地址http://www.zghlxwxcb.cn/news/detail-850670.html

到了這里,關(guān)于Spring AI - 使用向量數(shù)據(jù)庫實(shí)現(xiàn)檢索式AI對(duì)話的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來自互聯(lián)網(wǎng)用戶投稿,該文觀點(diǎn)僅代表作者本人,不代表本站立場(chǎng)。本站僅提供信息存儲(chǔ)空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請(qǐng)注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實(shí)不符,請(qǐng)點(diǎn)擊違法舉報(bào)進(jìn)行投訴反饋,一經(jīng)查實(shí),立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費(fèi)用

相關(guān)文章

  • 【向量數(shù)據(jù)庫】相似向量檢索Faiss數(shù)據(jù)庫的安裝及余弦相似度計(jì)算(C++)

    Faiss 是一個(gè)強(qiáng)大的向量相似度搜索庫,具有以下優(yōu)點(diǎn): 高效的搜索性能:Faiss 在處理大規(guī)模向量數(shù)據(jù)時(shí)表現(xiàn)出色。它利用了高度優(yōu)化的索引結(jié)構(gòu)和近似搜索算法,可以快速地執(zhí)行最近鄰搜索和相似度匹配,具有很低的查詢延遲。 高度可擴(kuò)展:Faiss 提供了多種索引結(jié)構(gòu)和算法

    2024年02月07日
    瀏覽(23)
  • 向量數(shù)據(jù)庫:使用Elasticsearch實(shí)現(xiàn)向量數(shù)據(jù)存儲(chǔ)與搜索

    Here’s the table of contents: ??Elasticsearch在7.x的版本中支持 向量檢索 。在向量函數(shù)的計(jì)算過程中,會(huì)對(duì)所有匹配的文檔進(jìn)行線性掃描。因此,查詢預(yù)計(jì)時(shí)間會(huì)隨著匹配文檔的數(shù)量線性增長(zhǎng)。出于這個(gè)原因,建議使用查詢參數(shù)來限制匹配文檔的數(shù)量(類似二次查找的邏輯,先使

    2024年02月07日
    瀏覽(98)
  • ModaHub魔搭社區(qū):AI原生云向量數(shù)據(jù)庫MIlvus Cloud實(shí)現(xiàn) HNSW

    ModaHub魔搭社區(qū):AI原生云向量數(shù)據(jù)庫MIlvus Cloud實(shí)現(xiàn) HNSW

    HNSW 并不簡(jiǎn)單,因此我們只在此處進(jìn)行最簡(jiǎn)單的實(shí)現(xiàn)。像之前一樣,我們首先創(chuàng)建一組(128 維)向量的數(shù)據(jù)集: 第一步是構(gòu)建 HNSW 索引。為此,我們需要將每個(gè)向量添加到我們的數(shù)據(jù)集中。我們首先創(chuàng)建一個(gè)數(shù)據(jù)結(jié)構(gòu)來保存索引。在這個(gè)基本示例中,我們將使用列表的列表來

    2024年02月15日
    瀏覽(25)
  • 神經(jīng)數(shù)據(jù)庫:用于使用 ChatGPT 構(gòu)建專用 AI 代理的下一代上下文檢索系統(tǒng) — (第 2/3 部分)

    神經(jīng)數(shù)據(jù)庫:用于使用 ChatGPT 構(gòu)建專用 AI 代理的下一代上下文檢索系統(tǒng) — (第 2/3 部分)

    書接上回理解構(gòu)建LLM驅(qū)動(dòng)的聊天機(jī)器人時(shí)的向量數(shù)據(jù)庫檢索的局限性 - (第1/3部分)_阿爾法旺旺的博客-CSDN博客 其中我們強(qiáng)調(diào)了( 1 )嵌入生成,然后( 2 )使用近似近鄰( ANN )搜索進(jìn)行矢量搜索的解耦架構(gòu)的缺點(diǎn)。我們討論了生成式 AI 模型生成的向量嵌入之間的余弦相似

    2024年02月15日
    瀏覽(16)
  • 理解構(gòu)建LLM驅(qū)動(dòng)的聊天機(jī)器人時(shí)的向量數(shù)據(jù)庫檢索的局限性 - (第1/3部分)

    理解構(gòu)建LLM驅(qū)動(dòng)的聊天機(jī)器人時(shí)的向量數(shù)據(jù)庫檢索的局限性 - (第1/3部分)

    本博客是一系列文章中的第一篇,解釋了為什么使用大型語言模型( LLM )部署專用領(lǐng)域聊天機(jī)器人的主流管道成本太高且效率低下。在第一篇文章中,我們將討論為什么矢量數(shù)據(jù)庫盡管最近流行起來,但在實(shí)際生產(chǎn)管道中部署時(shí)從根本上受到限制。在下面的文章中,我們說

    2024年02月14日
    瀏覽(21)
  • 《向量數(shù)據(jù)庫指南》——AI原生向量數(shù)據(jù)庫Milvus Cloud 2.3新功能

    《向量數(shù)據(jù)庫指南》——AI原生向量數(shù)據(jù)庫Milvus Cloud 2.3新功能

    支持用戶通過 upsert 接口更新或插入數(shù)據(jù)。已知限制,自增 id 不支持 upsert;upsert 是內(nèi)部實(shí)現(xiàn)是 delete + insert所以性能上會(huì)有一定損耗,如果明確知道是寫入數(shù)據(jù)的場(chǎng)景請(qǐng)繼續(xù)使用 insert。 支持用戶通過輸入?yún)?shù)指定 search 的 distance 進(jìn)行查詢,返回所有與目標(biāo)向量距離位于某一

    2024年02月09日
    瀏覽(25)
  • 向量數(shù)據(jù)庫——AI時(shí)代的基座

    向量數(shù)據(jù)庫——AI時(shí)代的基座

    向量數(shù)據(jù)庫 在構(gòu)建基于大語言模型的行業(yè) 智能應(yīng)用 中扮演著重要角色。大模型雖然能回答一般性問題,但在垂直領(lǐng)域服務(wù)中,其知識(shí)深度、準(zhǔn)確度和時(shí)效性有限。為了解決這一問題,企業(yè)可以利用向量數(shù)據(jù)庫結(jié)合大模型和自有知識(shí)資產(chǎn),構(gòu)建垂直領(lǐng)域的智能服務(wù)。 向量數(shù)據(jù)

    2024年02月05日
    瀏覽(28)
  • AI大模型崛起,向量數(shù)據(jù)庫登場(chǎng)

    引言 AI大模型的興起 2.1 深度學(xué)習(xí)與大模型 2.2 大模型的挑戰(zhàn) 向量數(shù)據(jù)庫的概念與應(yīng)用 3.1 向量表示與相似度計(jì)算 3.2 向量數(shù)據(jù)庫的優(yōu)勢(shì)與應(yīng)用場(chǎng)景 大模型與向量數(shù)據(jù)庫的結(jié)合 4.1 向量數(shù)據(jù)庫在大模型中的作用 4.2 大模型與向量數(shù)據(jù)庫的相互促進(jìn) 技術(shù)進(jìn)展與未來展望 5.1 近期技

    2024年02月15日
    瀏覽(42)
  • 向量數(shù)據(jù)庫,能讓AI再次起飛嗎?

    向量數(shù)據(jù)庫,能讓AI再次起飛嗎?

    9月7-8日,深圳國際會(huì)展中心18號(hào)館 來了,來了,騰訊面向產(chǎn)業(yè)互聯(lián)網(wǎng)領(lǐng)域規(guī)格最高、規(guī)模最大、覆蓋最廣的年度科技盛會(huì) -——- 騰訊全球數(shù)字生態(tài)大會(huì) 。 9 月 7 日,我們將 聚焦產(chǎn)業(yè)未來發(fā)展新趨勢(shì) ,針對(duì)云計(jì)算、大數(shù)據(jù)、人工智能、安全、 SaaS 等核心數(shù)字化工具做關(guān)鍵進(jìn)

    2024年02月09日
    瀏覽(16)
  • centos 安裝AI 向量數(shù)據(jù)庫 chroma

    1 官網(wǎng)地址:https://docs.trychroma.com/getting-started 有兩種方式:1,通過pip install ; 2 運(yùn)行docker。 本教程通過pip install 方式: 通過以下方式解決: 寫一個(gè)python測(cè)試程序 chromatest.py pip3 chromatest.py 運(yùn)行報(bào)錯(cuò): ImportError: zstd C API versions mismatch; Python bindings were not compiled/linked against expect

    2024年02月09日
    瀏覽(23)

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請(qǐng)作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包