cuery.builder.chat ================== .. py:module:: cuery.builder.chat .. autoapi-nested-parse:: Implements graio-compatible chat functionality. I.e. the logic of interaction with OpenAI etc. Attributes ---------- .. autoapisummary:: cuery.builder.chat.SYSTEM_PROMPT cuery.builder.chat.SCHEMA_CONTEXT cuery.builder.chat.CURRENT_SCHEMA cuery.builder.chat.CLIENT Classes ------- .. autoapisummary:: cuery.builder.chat.SchemaResponse Functions --------- .. autoapisummary:: cuery.builder.chat.connect cuery.builder.chat.ai_chat cuery.builder.chat.chat Module Contents --------------- .. py:data:: SYSTEM_PROMPT :value: '' .. py:data:: SCHEMA_CONTEXT :value: Multiline-String .. raw:: html
Show Value .. code-block:: python """ Please modify, extend, or replace the schema in the following section based on the user's request. If the user wants to add fields, merge them with the existing schema. If they want to remove fields, remove them from the existing schema. If they want to modify field types or descriptions, update the existing schema accordingly. ## Current Schema {schema} """ .. raw:: html
.. py:class:: SchemaResponse(/, **data) Bases: :py:obj:`pydantic.BaseModel` Response from the AI that includes both conversation and schema update. .. py:attribute:: answer :type: str :value: None .. py:attribute:: reasoning :type: str :value: None .. py:attribute:: structure :type: dict[str, Any] :value: None .. py:attribute:: example_data :type: list[dict[str, Any]] :value: None .. py:method:: validate_json_schema(structure) :classmethod: Validate that the schema is a proper JSON schema. .. py:method:: validate_example_data_against_schema(example_data, info) :classmethod: Validate that example data conforms to the schema. .. py:data:: CURRENT_SCHEMA :value: None .. py:data:: CLIENT :value: None .. py:function:: connect() Connect to OpenAI API using instructor. .. py:function:: ai_chat(message, history) Send message to OpenAI and get response with structured output. .. py:function:: chat(message, history) Call LLM API with message and history and return response