++
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
import os
|
||||
import random
|
||||
import sys
|
||||
import json
|
||||
import openai
|
||||
import httpx
|
||||
import csv
|
||||
@@ -15,7 +14,9 @@ PROJECT_PATH = os.path.join(os.path.abspath(__file__).split('AlphaGenerator')[0]
|
||||
PREPARE_PROMPT = os.path.join(PROJECT_PATH, 'prepare_prompt')
|
||||
KEYS_TEXT = os.path.join(PREPARE_PROMPT, 'keys_text.txt')
|
||||
|
||||
SELECT_DATA_SET_QTY = 30
|
||||
TEMPERATURE = 0.1
|
||||
|
||||
USE_AI = 1
|
||||
|
||||
SILICONFLOW_API_KEY = "sk-pvdiisdowmuwkrpnxsrlhxaovicqibmlljwrwwvbbdjaitdl"
|
||||
SILICONFLOW_BASE_URL = "https://api.siliconflow.cn/v1"
|
||||
@@ -160,7 +161,11 @@ def call_siliconflow(prompt, model):
|
||||
|
||||
response = client.chat.completions.create(
|
||||
model=model,
|
||||
messages=[{"role": "user", "content": prompt}]
|
||||
messages=[
|
||||
{"role": "system", "content": "你是一个专业的量化投资专家,擅长编写Alpha因子。"},
|
||||
{"role": "user", "content": prompt}
|
||||
],
|
||||
temperature=TEMPERATURE
|
||||
)
|
||||
|
||||
return response.choices[0].message.content
|
||||
@@ -299,9 +304,10 @@ def main():
|
||||
# # 如果需要手动在页面段模型, 使用提示词, 打开这个, 将生成的提示词存到本地
|
||||
manual_prompt(prompt)
|
||||
|
||||
# for model in MODELS:
|
||||
# # 如果需要使用模型, 打开这个
|
||||
# call_ai(prompt, model)
|
||||
if USE_AI:
|
||||
for model in MODELS:
|
||||
# 如果需要使用模型, 打开这个
|
||||
call_ai(prompt, model)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user