xia_gpt_openai.gpt.OpenaiGpt4
- class xia_gpt_openai.gpt.OpenaiGpt4
Bases:
OpenaiGpt
- __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 `
Attributes
gpt_engine_model
gpt_engine_name
- chat_complete(system: str, message: str, context: Optional[list] = None, **kwargs)
Give the context and
- Parameters
system – System Roles
message – User message to be sent
context – previous dialog to be passed as parameters as a list of conversion. each conversion contains user and assistant part, like: {“user”: “Hello”, “assistant”: “World”}
**kwargs – other parameters
- Returns
result and the job results
- 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