· ☕ 1 分钟
  • 微服务各种流控技术
    *

  • 分布式一致性技术

    • 数据一致性协议
  • Java

    • 网络 Netty
    • Thread Pool
  • DB
    *


· ☕ 22 分钟

J: welcome everyone to another Agent

Gateway community meeting. Um, we have a few items but nothing.

Um, if you have anything else like feel free

to add it. Uh, we can we can go and uh go in order.

Uh, while we’re getting our names in there and some agenda. Yeah, Carlos,

what’s up?

C: No, just like uh as a as a standing thing like just um we can have


· ☕ 0 分钟

· ☕ 6 分钟
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
from langchain.llms import Ollama
from langchain.embeddings import OllamaEmbeddings
from langchain.chains import RetrievalQA
from langchain.vectorstores import FAISS
from langchain.text_splitter import CharacterTextSplitter
from langchain.document_loaders import TextLoader

# 加载本地模型
llm = Ollama(model="llama2")
embeddings = OllamaEmbeddings(model="llama2")

# 加载文档
loader = TextLoader("your_knowledge_base.txt")
documents = loader.load()

# 切分文本
text_splitter = CharacterTextSplitter(chunk_size=1000, chunk_overlap=0)
texts = text_splitter.split_documents(documents)

# 创建向量数据库
db = FAISS.from_documents(texts, embeddings)

# 创建问答链
qa = RetrievalQA.from_chain_type(llm=llm, chain_type="stuff", retriever=db.as_retriever())

# 提问
query = "你的问题是什么?"
result = qa.run(query)

print(result)

FAISS.from_documents()

上面程序中,FAISS.from_documents 是什么作用?


· ☕ 6 分钟

HTTP with SSE(v2024-11-05)

https://modelcontextprotocol.io/specification/2024-11-05/basic/transports#http-with-sse

The server MUST provide two endpoints:

  1. An SSE endpoint, for clients to establish a connection and receive messages from the server
  2. A regular HTTP POST endpoint for clients to send messages to the server

双连接,一个SSE,一个POST。 SSE 用于服务器推送,POST用于客户端发送。