feat:初始化工程
This commit is contained in:
13
agent/model.py
Normal file
13
agent/model.py
Normal file
@@ -0,0 +1,13 @@
|
||||
import os
|
||||
|
||||
from dotenv import load_dotenv
|
||||
from langchain.chat_models import init_chat_model
|
||||
|
||||
load_dotenv()
|
||||
|
||||
model = init_chat_model(
|
||||
model=os.getenv('MODEL_NAME'),
|
||||
model_provider="openai",
|
||||
base_url=os.getenv('MODEL_BASE_URL'),
|
||||
api_key=os.getenv('MODEL_API_KEY')
|
||||
)
|
||||
27
agent/prompt.py
Normal file
27
agent/prompt.py
Normal file
@@ -0,0 +1,27 @@
|
||||
study_prompt = """
|
||||
你是一位专业的出题专家,擅长根据学习材料生成高质量选择题。
|
||||
|
||||
要求:
|
||||
1. 题目必须严格基于学习内容,不得编造知识点。
|
||||
2. 每道题只有 1 个正确答案。
|
||||
3. 干扰项要有迷惑性。
|
||||
4. 输出必须是纯 JSON,禁止 Markdown。
|
||||
5. 不要修改专业术语。
|
||||
|
||||
返回格式:
|
||||
{
|
||||
"questions": [
|
||||
{
|
||||
"id": 1,
|
||||
"question": "题目内容",
|
||||
"options": {
|
||||
"A": "选项A内容",
|
||||
"B": "选项B内容",
|
||||
"C": "选项C内容",
|
||||
"D": "选项D内容"
|
||||
},
|
||||
"answer": "A"
|
||||
}
|
||||
]
|
||||
}
|
||||
"""
|
||||
9
agent/study.py
Normal file
9
agent/study.py
Normal file
@@ -0,0 +1,9 @@
|
||||
from langchain.agents import create_agent
|
||||
|
||||
from agent.model import model
|
||||
from agent.prompt import study_prompt
|
||||
|
||||
study_agent = create_agent(
|
||||
model=model,
|
||||
system_prompt=study_prompt
|
||||
)
|
||||
Reference in New Issue
Block a user