MCPcopy Create free account
hub / github.com/CL-lau/SQL-GPT / askQuestion

Method askQuestion

gpt/llm.py:99–106  ·  view source on GitHub ↗
(self, question: Optional[str], topK: Optional[int] = 4, fileID: Optional[str] = None)

Source from the content-addressed store, hash-verified

97 return fileID
98
99 def askQuestion(self, question: Optional[str], topK: Optional[int] = 4, fileID: Optional[str] = None):
100 # TODO 查询embedding
101 # db = Chroma.from_texts(documents, OpenAIEmbeddings())
102 # docs = db.similarity_search(query=question, k=topK)
103 docs = self.embeddingHelper.similarity_search(query=question, collectionId=fileID, topK=topK)
104
105 question = self.prompt.format(context=docs, question=question)
106 return self.llm.generate_response(input_text=question)
107
108
109class SqlGPT:

Callers 1

file_chatFunction · 0.95

Calls 2

generate_responseMethod · 0.80
similarity_searchMethod · 0.45

Tested by

no test coverage detected