remove settingsetting
This commit is contained in:
parent
40bd50c439
commit
99755ceab5
@ -11,7 +11,6 @@ import json_repair
|
|||||||
from psycopg2 import pool
|
from psycopg2 import pool
|
||||||
|
|
||||||
from .mem0_config import Mem0Config
|
from .mem0_config import Mem0Config
|
||||||
from utils.settings import MEM0_EMBEDDING_MODEL
|
|
||||||
|
|
||||||
logger = logging.getLogger("app")
|
logger = logging.getLogger("app")
|
||||||
|
|
||||||
|
|||||||
@ -1,45 +0,0 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
import csv
|
|
||||||
import yaml
|
|
||||||
import sys
|
|
||||||
|
|
||||||
def csv_to_yaml(csv_file, yaml_file):
|
|
||||||
"""Convert CSV file to YAML format for promptfoo tests"""
|
|
||||||
|
|
||||||
tests = []
|
|
||||||
|
|
||||||
with open(csv_file, 'r', encoding='utf-8-sig') as f:
|
|
||||||
reader = csv.DictReader(f)
|
|
||||||
|
|
||||||
for row in reader:
|
|
||||||
if row['question']:
|
|
||||||
test_case = {
|
|
||||||
'vars': {
|
|
||||||
'question': row['question'].strip(),
|
|
||||||
'use_history': True if row['use_history'] == "1" else False,
|
|
||||||
},
|
|
||||||
'assert':[]
|
|
||||||
}
|
|
||||||
|
|
||||||
if row['regex'] and row['regex'].strip():
|
|
||||||
test_case['assert'].append({
|
|
||||||
'type': 'regex',
|
|
||||||
'value': row['regex'].strip()
|
|
||||||
})
|
|
||||||
|
|
||||||
# Add llm-rubric if present
|
|
||||||
if row['llm-rubric'] and row['llm-rubric'].strip():
|
|
||||||
test_case['assert'].append({
|
|
||||||
'type': 'llm-rubric',
|
|
||||||
'value': row['llm-rubric'].strip()
|
|
||||||
})
|
|
||||||
|
|
||||||
tests.append(test_case)
|
|
||||||
|
|
||||||
with open(yaml_file, 'w', encoding='utf-8') as f:
|
|
||||||
yaml.dump(tests, f, default_flow_style=False, allow_unicode=True, sort_keys=False)
|
|
||||||
|
|
||||||
print(f"Converted {len(tests)} test cases from {csv_file} to {yaml_file}")
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
csv_to_yaml("novare/novare.csv", "novare/tests.yaml")
|
|
||||||
@ -1,28 +0,0 @@
|
|||||||
env: {}
|
|
||||||
description: Novare Test - Unified Config for Both Single and Conversation
|
|
||||||
providers:
|
|
||||||
- id: openai:chat:qwen3
|
|
||||||
config:
|
|
||||||
apiBaseUrl: https://catalog-agent-dev.gbase.ai/api/v2
|
|
||||||
apiKey: a21c99620a8ef61d69563afe05ccce89
|
|
||||||
passthrough:
|
|
||||||
bot_id: 63069654-7750-409d-9a58-a0960d899a20
|
|
||||||
tool_response: true
|
|
||||||
language: zh
|
|
||||||
prompts:
|
|
||||||
- file://prompt.json
|
|
||||||
nunjucksFilters:
|
|
||||||
encode: ./encode.js
|
|
||||||
tests: file://tests.yaml
|
|
||||||
defaultTest:
|
|
||||||
options:
|
|
||||||
provider:
|
|
||||||
text:
|
|
||||||
id: openai:chat:qwen/qwen3-next-80b-a3b-instruct
|
|
||||||
config:
|
|
||||||
apiKey: sk-hsKClH0Z695EkK5fDdB2Ec2fE13f4fC1B627BdBb8e554b5b-26
|
|
||||||
apiBaseUrl: https://one.felo.me/v1
|
|
||||||
apiVersion: '2024-02-01'
|
|
||||||
evaluateOptions: {}
|
|
||||||
writeLatestResults: true
|
|
||||||
sharing: true
|
|
||||||
@ -1,11 +0,0 @@
|
|||||||
module.exports = function (str) {
|
|
||||||
if (typeof str !== 'string') {
|
|
||||||
return str;
|
|
||||||
}
|
|
||||||
return str
|
|
||||||
.replace(/\\/g, '\\\\') // 转义反斜杠
|
|
||||||
.replace(/"/g, '\\"') // 转义双引号
|
|
||||||
.replace(/\n/g, '\\n') // 转义换行符
|
|
||||||
.replace(/\r/g, '\\r') // 转义回车符
|
|
||||||
.replace(/\t/g, '\\t'); // 转义制表符
|
|
||||||
};
|
|
||||||
@ -1,14 +0,0 @@
|
|||||||
question,use_history,regex,llm-rubric,,,,,,,,,,,,,,,,,
|
|
||||||
清水太郎在哪里,1,\[TOOL_CALL\].*find_employee_location,,,,,,,,,,,,,,,,,,
|
|
||||||
通知他明天上午8点开会,1,,询问是否确认发送,,,,,,,,,,,,,,,,,
|
|
||||||
确认,1,\[TOOL_CALL\].*wowtalk_send_message_to_member,,,,,,,,,,,,,,,,,,
|
|
||||||
把DefineRoom 4的灯光状态发给他,1,,调用find_devices_by_room和dxcore_get_device_status获取灯光状态,并询问是否确认发送。,,,,,,,,,,,,,,,,,
|
|
||||||
确认,1,\[TOOL_CALL\].*wowtalk_send_message_to_member,,,,,,,,,,,,,,,,,,
|
|
||||||
关闭设备900142的灯光,1,,询问是否确认关闭,,,,,,,,,,,,,,,,,
|
|
||||||
确认,1,\[TOOL_CALL\].*dxcore_update_device_status,,,,,,,,,,,,,,,,,,
|
|
||||||
Define Room1 的灯光状态,0,\[TOOL_CALL\].*find_devices_by_room,,,,,,,,,,,,,,,,,,
|
|
||||||
900142の稼働状況,0,\[TOOL_CALL\].*dxcore_get_device_status,,,,,,,,,,,,,,,,,,
|
|
||||||
卫生间在哪里,0,\[TOOL_CALL\].*rag_retrieve,,,,,,,,,,,,,,,,,,
|
|
||||||
我丢了物品怎么办,0,\[TOOL_CALL\].*rag_retrieve,,,,,,,,,,,,,,,,,,
|
|
||||||
咖啡多少钱一杯,0,\[TOOL_CALL\].*rag_retrieve,,,,,,,,,,,,,,,,,,
|
|
||||||
东京明天的天气,0,\[TOOL_CALL\].*weather_get_by_location,,,,,,,,,,,,,,,,,,
|
|
||||||
|
@ -1,23 +0,0 @@
|
|||||||
[
|
|
||||||
{% if use_history %}
|
|
||||||
{% for completion in _conversation %}
|
|
||||||
{
|
|
||||||
"role": "user",
|
|
||||||
"content": "{{ completion.input | encode }}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"role": "assistant",
|
|
||||||
"content": "{{ completion.output | encode }}"
|
|
||||||
},
|
|
||||||
{% endfor %}
|
|
||||||
{
|
|
||||||
"role": "user",
|
|
||||||
"content": "{{ question | encode }}"
|
|
||||||
}
|
|
||||||
{% else %}
|
|
||||||
{
|
|
||||||
"role": "user",
|
|
||||||
"content": "{{ question }}"
|
|
||||||
}
|
|
||||||
{% endif %}
|
|
||||||
]
|
|
||||||
@ -1,78 +0,0 @@
|
|||||||
- vars:
|
|
||||||
question: 清水太郎在哪里
|
|
||||||
use_history: true
|
|
||||||
assert:
|
|
||||||
- type: regex
|
|
||||||
value: \[TOOL_CALL\].*find_employee_location
|
|
||||||
- vars:
|
|
||||||
question: 通知他明天上午8点开会
|
|
||||||
use_history: true
|
|
||||||
assert:
|
|
||||||
- type: llm-rubric
|
|
||||||
value: 询问是否确认发送
|
|
||||||
- vars:
|
|
||||||
question: 确认
|
|
||||||
use_history: true
|
|
||||||
assert:
|
|
||||||
- type: regex
|
|
||||||
value: \[TOOL_CALL\].*wowtalk_send_message_to_member
|
|
||||||
- vars:
|
|
||||||
question: 把DefineRoom 4的灯光状态发给他
|
|
||||||
use_history: true
|
|
||||||
assert:
|
|
||||||
- type: llm-rubric
|
|
||||||
value: 调用find_devices_by_room和dxcore_get_device_status获取灯光状态,并询问是否确认发送。
|
|
||||||
- vars:
|
|
||||||
question: 确认
|
|
||||||
use_history: true
|
|
||||||
assert:
|
|
||||||
- type: regex
|
|
||||||
value: \[TOOL_CALL\].*wowtalk_send_message_to_member
|
|
||||||
- vars:
|
|
||||||
question: 关闭设备900142的灯光
|
|
||||||
use_history: true
|
|
||||||
assert:
|
|
||||||
- type: llm-rubric
|
|
||||||
value: 询问是否确认关闭
|
|
||||||
- vars:
|
|
||||||
question: 确认
|
|
||||||
use_history: true
|
|
||||||
assert:
|
|
||||||
- type: regex
|
|
||||||
value: \[TOOL_CALL\].*dxcore_update_device_status
|
|
||||||
- vars:
|
|
||||||
question: Define Room1 的灯光状态
|
|
||||||
use_history: false
|
|
||||||
assert:
|
|
||||||
- type: regex
|
|
||||||
value: \[TOOL_CALL\].*find_devices_by_room
|
|
||||||
- vars:
|
|
||||||
question: 900142の稼働状況
|
|
||||||
use_history: false
|
|
||||||
assert:
|
|
||||||
- type: regex
|
|
||||||
value: \[TOOL_CALL\].*dxcore_get_device_status
|
|
||||||
- vars:
|
|
||||||
question: 卫生间在哪里
|
|
||||||
use_history: false
|
|
||||||
assert:
|
|
||||||
- type: regex
|
|
||||||
value: \[TOOL_CALL\].*rag_retrieve
|
|
||||||
- vars:
|
|
||||||
question: 我丢了物品怎么办
|
|
||||||
use_history: false
|
|
||||||
assert:
|
|
||||||
- type: regex
|
|
||||||
value: \[TOOL_CALL\].*rag_retrieve
|
|
||||||
- vars:
|
|
||||||
question: 咖啡多少钱一杯
|
|
||||||
use_history: false
|
|
||||||
assert:
|
|
||||||
- type: regex
|
|
||||||
value: \[TOOL_CALL\].*rag_retrieve
|
|
||||||
- vars:
|
|
||||||
question: 东京明天的天气
|
|
||||||
use_history: false
|
|
||||||
assert:
|
|
||||||
- type: regex
|
|
||||||
value: \[TOOL_CALL\].*weather_get_by_location
|
|
||||||
@ -78,14 +78,4 @@ MEM0_ENABLED = os.getenv("MEM0_ENABLED", "true") == "true"
|
|||||||
# 召回记忆数量
|
# 召回记忆数量
|
||||||
MEM0_SEMANTIC_SEARCH_TOP_K = int(os.getenv("MEM0_SEMANTIC_SEARCH_TOP_K", "20"))
|
MEM0_SEMANTIC_SEARCH_TOP_K = int(os.getenv("MEM0_SEMANTIC_SEARCH_TOP_K", "20"))
|
||||||
|
|
||||||
# 记忆注入配置
|
|
||||||
# 是否将记忆注入到系统提示
|
|
||||||
MEM0_INJECT_TO_SYSTEM_PROMPT = os.getenv("MEM0_INJECT_TO_SYSTEM_PROMPT", "true") == "true"
|
|
||||||
|
|
||||||
# 嵌入模型(多语言支持)
|
|
||||||
# 使用本地 sentence-transformers 模型
|
|
||||||
MEM0_EMBEDDING_MODEL = os.getenv(
|
|
||||||
"MEM0_EMBEDDING_MODEL",
|
|
||||||
"./models/gte-tiny"
|
|
||||||
)
|
|
||||||
os.environ["OPENAI_API_KEY"] = "your_api_key"
|
os.environ["OPENAI_API_KEY"] = "your_api_key"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user