Skip to content

Commit

Permalink
feat:able to use openai in data-processing
Browse files Browse the repository at this point in the history
  • Loading branch information
wangxinbiao committed Jan 24, 2024
1 parent cb798c2 commit af1ee1b
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions pypi/data-processing/src/file_handle/common_handle.py
Original file line number Diff line number Diff line change
Expand Up @@ -992,6 +992,25 @@ def _generate_qa_list(content, llm_config):
return data

qa_list.extend(data.get("data"))

elif llm_type == "openai":
# generate QA list
qa_provider = QAProviderOpenAI(
api_key="fake",
base_url=base_url,
model=model,
temperature=temperature,
max_tokens=max_tokens,
)

data = qa_provider.generate_qa_list(
text=content, prompt_template=prompt_template
)

if data.get("status") != 200:
return data

qa_list.extend(data.get("data"))
else:
return {"status": 1000, "message": "暂时不支持该类型的模型", "data": ""}

Expand Down

0 comments on commit af1ee1b

Please sign in to comment.