Lines Matching refs:question
163 * Ask a question with a chat history
165 * @param string $question
167 * @return array ['question' => $question, 'answer' => $answer, 'sources' => $sources]
170 public function askChatQuestion($question, $history = [])
173 $contextQuestion = $this->rephraseChatQuestion($question, $history);
175 // Only use the rephrased question if it has more history than the chat history provides
177 $question = $contextQuestion;
180 $contextQuestion = $question;
182 return $this->askQuestion($question, $history, $contextQuestion);
186 * Ask a single standalone question
188 * @param string $question The question to ask
189 * @param array $history [user, ai] of the previous question
190 * @param string $contextQuestion The question to use for context search
191 * @return array ['question' => $question, 'answer' => $answer, 'sources' => $sources]
194 public function askQuestion($question, $history = [], $contextQuestion = '')
196 $similar = $this->getEmbeddings()->getSimilarChunks($contextQuestion ?: $question, $this->getLanguageLimit());
202 $prompt = $this->getPrompt('question', [
204 'question' => $question,
208 'question' => $question,
222 'question' => $question,
230 * Rephrase a question into a standalone question based on the chat history
232 * @param string $question The original user question
234 * @return string The rephrased question
237 public function rephraseChatQuestion($question, $history)
240 'question' => $question,
255 * @param string $promptedQuestion The user question embedded in a prompt