xia_gpt_openai.gpt.Gpt

class xia_gpt_openai.gpt.Gpt

Bases: object

__init__()

Methods

__init__()

build_request(system, message[, context])

chat_complete(system, message[, context])

Give the context and

chat_complete_stream(system, message[, context])

Give the context and

extract_code_blocks(message)

Extract code blocks embraced by ` code `

chat_complete(system: str, message: str, context: Optional[list] = None, **kwargs)

Give the context and

Parameters
  • system – System Roles

  • context – chat context

  • message – message to be sent

  • **kwargs – other parameters

async chat_complete_stream(system: str, message: str, context: Optional[list] = None, **kwargs)

Give the context and

Parameters
  • system – System Roles

  • context – chat context

  • message – message to be sent

  • **kwargs – other parameters

classmethod extract_code_blocks(message: str) list

Extract code blocks embraced by ` code `

Parameters

message

Returns

  • type: code type (like python, json or might be empty)

  • body: code body (Code)

Return type

List of the dictionary with the following structure