1. Prompt Engineering

S - Prompt engineering Problem is Task: Write in the style of Shakespeare…/Shared template Everyone need to prompt the same prompt, a waste of time Chain/need is User input Prompt template: combine user input with base template Model: switch models as needed Domain is Prompt engineering T - Dify No code Define and modIFY A - Prompt template - one round Text generator Prompt generator <instruction> Generate a catchy and memorable slogan based on the provided company description. Follow these steps: 1. Read the company description carefully to understand its core values, mission, and target audience. 2. Identify key themes or unique selling points from the description. 3. Craft a slogan that is short, impactful, and aligns with the company's identity. 4. Ensure the slogan is original and avoids clichés unless they fit exceptionally well. 5. The output should be a single slogan without any additional explanations or XML tags. Input variables: - {{company_description}}: A brief description of the company, including its industry, values, and target audience. </instruction> <input> {{company_description}} </input> <output> A single-line slogan reflecting the company's identity. </output> <example> <input> A sustainable fashion brand that uses recycled materials to create stylish clothing for eco-conscious consumers. </input> <output> "Wear the Change You Wish to See." </output> </example> A - Prompt template - multi rounds Chatbot ...

July 15, 2025 · 2 min · Hongyao Tang

2. RAG

S - RAG Problem is Task: Seach entire books/Large external data Coping text from books and paste in gpt, exceeding the context size Chain is Indexing/Embedding path Document loaders Test splitters Embedding models Vector stores: Pinecone, FAISS, or Azure Cognitive Search Retriving/Retrieval path Embedding Compare Search to select Convert to text LLM Domain is RAG T - Dify A - Knowledge is RAG Index Retrieve T - Keyword search 字面匹配 T - Vector search 关键词搜索,严格的字面匹配,只能识别发明人 向量搜索,嵌入+语义搜索,识别近义词,能识别创造者 3 Steps ...

July 15, 2025 · 9 min · Hongyao Tang

3. Agent

S - Agent Problem is Tasks/Multiple external tools Search Entire Books/RAG SQL operations Search Internet Need tools Autommous call tools with self-analysis, without deterministic worflow for step 1,2,3 Chain is Agent tools DuckDuckGo search Zapier NLA Shell Python REPL Chains/Agents/Custom functions Domain is Agent T - Dify Tools and autonomous calling Also a MCP client T - MCP: Unify the protocol to interact with external systems ...

July 15, 2025 · 13 min · Hongyao Tang

4. Workflow

S - Determinism T - Dify A - Workflow - Agentic flow for automations, control the overall orchestration A - Chatflow - Workflow enhanced for chats - control the doing behind chat chatbox or agent, the doing behind is controlled by LLM

July 15, 2025 · 1 min · Hongyao Tang

5. Project

Memory tracker track what you do ask to save certain memories recall those memories T - RAG as one of MCP server backends Save Search Normal Data in text file Keyword search RAG Data in text file to embeddings in verctore store Sematic search is more accurate than keyword search ################ Vector store ################ client.vector_stores.create(name="MEMORIESTWO") stores = client.vector_stores.list() client.vector_stores.files.upload_and_poll( vector_store_id=vector_store.id, file=open(f.name, "rb") ) # 使用你的 client 对象上传文件。 # vector_store_id 是你目标向量数据库的 ID。 # 用 open(f.name, "rb") 以二进制方式读取刚才创建的临时文件。 # upload_and_poll 方法会上传文件并等待处理完成(可能包括嵌入处理等)。 results = client.vector_stores.search( vector_store_id=vector_store.id, query=query, ) ################# Var to temfile ################ with tempfile.NamedTemporaryFile(mode="w+", delete=False, suffix=".txt") as f: # 使用 tempfile.NamedTemporaryFile 创建一个临时文件 # mode="w+" 表示你可以读写这个文件。 # delete=False 是为了让文件在关闭后不会被自动删除(因为你后续还需要上传它)。 # suffix=".txt" 是文件的扩展名 f.write(memory) f.flush() # 将 memory 的内容写入这个临时文件。 # flush() 是为了确保数据真的写进了磁盘,而不是停留在缓冲区。 OpenAI上的Vector store ...

July 14, 2025 · 2 min · Hongyao Tang