Skip to content

OpenAI Functions Agent node#

ใช้ OpenAI Functions Agent node เพื่อใช้ OpenAI functions model เหล่านี้คือ models ที่ตรวจจับว่าเมื่อใดควรเรียกใช้ function และตอบสนองด้วย inputs ที่ควรส่งผ่านไปยัง function นั้น

อ้างอิง AI Agent สำหรับข้อมูลเพิ่มเติมเกี่ยวกับ AI Agent node เอง

คุณสามารถใช้ agent นี้กับ Chat Trigger node ได้ เชื่อมต่อ memory sub-node เพื่อให้ผู้ใช้สามารถสนทนาต่อเนื่องด้วยคำถามหลายๆ ครั้งได้ Memory จะไม่คงอยู่ระหว่าง session

OpenAI Chat Model required

คุณต้องใช้ OpenAI Chat Model กับ agent นี้

Node parameters#

กำหนดค่า OpenAI Functions Agent โดยใช้ parameters ต่อไปนี้

Prompt#

Prompt (ข้อความแจ้ง)#

เลือกวิธีที่คุณต้องการให้ node สร้าง prompt (หรือที่เรียกว่า query ของผู้ใช้ หรือ input จากแชท)

เลือกจาก:

  • Take from previous node automatically (รับจาก node ก่อนหน้าโดยอัตโนมัติ): หากคุณเลือกตัวเลือกนี้ node จะคาดหวัง input จาก node ก่อนหน้าชื่อ chatInput
  • Define below (กำหนดด้านล่าง): หากคุณเลือกตัวเลือกนี้ ให้ระบุข้อความคงที่หรือ expression สำหรับเนื้อหาแบบไดนามิกเพื่อใช้เป็น prompt ในฟิลด์ Prompt (User Message)

Require Specific Output Format#

Output Format (รูปแบบ Output)#

พารามิเตอร์นี้ควบคุมว่าคุณต้องการให้ node กำหนดรูปแบบ output ที่เฉพาะเจาะจงหรือไม่ เมื่อเปิดใช้งาน n8n จะแจ้งให้คุณเชื่อมต่อ output parser หนึ่งในรายการต่อไปนี้เข้ากับ node:

Node options#

ปรับแต่งพฤติกรรมของ OpenAI Functions Agent node โดยใช้ options เหล่านี้:

System Message#

System Message (ข้อความระบบ)#

หากคุณต้องการส่งข้อความไปยัง agent ก่อนเริ่มการสนทนา ให้ป้อนข้อความที่คุณต้องการส่ง

ใช้ตัวเลือกนี้เพื่อชี้นำการตัดสินใจของ agent

Max Iterations#

Max Iterations (จำนวนรอบสูงสุด)#

ป้อนจำนวนครั้งที่โมเดลควรทำงานเพื่อพยายามสร้างคำตอบที่ดีจาก prompt ของผู้ใช้

ค่าเริ่มต้นคือ 10

Return Intermediate Steps#

Return Intermediate Steps (ส่งคืนขั้นตอนกลาง)#

เลือกว่าจะรวมขั้นตอนกลางที่ agent ใช้ในการประมวลผลไว้ใน output สุดท้ายหรือไม่ (เปิด) หรือไม่รวม (ปิด)

สิ่งนี้อาจมีประโยชน์สำหรับการปรับแต่งพฤติกรรมของ agent เพิ่มเติมโดยอิงตามขั้นตอนที่ดำเนินการ

Templates and examples#

อ้างอิงส่วน Templates and examples ของ AI Agent node หลัก

Common issues#

สำหรับคำถามหรือปัญหาทั่วไปและแนวทางแก้ไขที่แนะนำ โปรดดูที่ Common issues

AI glossary#

  • completion: Completions are the responses generated by a model like GPT.
  • hallucinations: Hallucination in AI is when an LLM (large language model) mistakenly perceives patterns or objects that don't exist.
  • vector database: A vector database stores mathematical representations of information. Use with embeddings and retrievers to create a database that your AI can access when answering questions.
  • vector store: A vector store, or vector database, stores mathematical representations of information. Use with embeddings and retrievers to create a database that your AI can access when answering questions.