Mika Scraper / DeepseekR1
Function: DeepseekR1()
DeepseekR1(
question: string,useWebSearch?: boolean):Promise<GradioChatOutput>
Defined in: src/deepseek-r1/deepseek.ts:57
The DeepseekR1 function sends a userβs question to a remote AI model hosted via Gradio on Hugging Face and listens for the final generated response using Server-Sent Events (SSE). This function is instrumental for real-time interaction with AI models.
Parameters
question
- Type:
string - Description: The userβs prompt or message that will be sent to the AI model for processing.
useWebSearch
- Type:
boolean(optional) - Default:
false - Description: An optional flag to enable enhanced web search capabilities within the AI model to refine responses. If set to
true, the model may leverage online resources to provide more accurate information.
Returns
- Type:
Promise<GradioChatOutput> - Description: A promise that resolves with the AI-generated response upon successful processing.
Throws
The function may throw an error in the following conditions:
- If the HTTP request to the AI service fails.
- If there is an issue encountered while establishing the event stream.
Example
const question = "What are the benefits of TypeScript?";
const useWebSearch = true;
DeepseekR1(question, useWebSearch)
.then(response => {
console.log(response);
})
.catch(error => {
console.error("Error:", error);
});Last updated on