评分系统分流部分的代码
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

30 行
804 B

  1. # coding=utf-8
  2. from llms.llm import Llm
  3. import requests
  4. import json
  5. class Liandongllm(Llm):
  6. def __init__(self, **param):
  7. self.api_url = param['api_url']
  8. def link(self, question):
  9. headers = {
  10. 'Content-Type': 'json',
  11. 'Content-Length': '<calculated when request is sent>'
  12. }
  13. data = {
  14. "category": "bj_unicom",
  15. "messages": [
  16. {
  17. "role": "user",
  18. "content": question
  19. }
  20. ]
  21. }
  22. result = requests.post(self.api_url,
  23. headers=headers,
  24. data=json.dumps(data))
  25. result_json = json.loads(result.text)
  26. return result_json['data'][0]['text'], 0