Skip to content
This repository has been archived by the owner on Jun 15, 2024. It is now read-only.

Message

OGIOS edited this page Sep 25, 2023 · 1 revision

Message body contains the content and web search process, returned by Bot.chat()

Properties

    def __init__(self, conversation_id: str, web_search_enabled: bool):
        self.error: Exception | None = None
        self.conversation_id: str = conversation_id
        self.done: bool = False
        self.stream_text: List[str] = []
        self.final_text: str | None = None
        self.web_search_enabled = web_search_enabled
        self.web_search_done = False
        self.web_search_steps: List = list()
        self.web_search_step = -1

        self.temp: List[str] = []
        self.count = 0
        self.threshold = 3
  • stream_text:
    content split by chars

  • final_text:
    the whole text that will be set after the request is done

  • web_search_steps:

    • one with message & args which is for the actual web search process.
    • one with sources as a list, contains title & host & link.
  • web_search_step:
    != len(web_search_steps) - 1 , please see self.getWebSearchStep.

  • temp & count & threshold:
    No need to be concerned, they exist for stream_text

Usage

Get WebSearch Steps

def getWebSearchSteps(self) -> List[dict]

returns self.web_search_steps.
raises Exception if self.error != None

Get Web Search Step

def getWebSearchStep(self) -> dict | None

return self.web_search_steps[self.web_search_step].
web_search_step increases each time this function is called

Get Text

def getText(self) -> List[str]

returns self.stream_text.
raises Exception if self.error != None

Get Final Text

def getFinalText(self) -> str | None

returns self.final_text.
raises Exception if self.error != None

Feel free to ask any questions or share me with your thoughts!

Clone this wiki locally