diff --git a/docs/ai/index.rst b/docs/ai/index.rst index 7ff8c00a333..deb7dc610e7 100644 --- a/docs/ai/index.rst +++ b/docs/ai/index.rst @@ -4,6 +4,18 @@ Gel AI ====== +.. toctree:: + :hidden: + :maxdepth: 3 + + javascript + guide_edgeql + guide_python + quickstart_fastapi_ai + reference_extai + reference_http + reference_python + :edb-alt-title: Using Gel AI |Gel| AI is a set of tools designed to enable you to ship AI-enabled apps with diff --git a/docs/ai/javascript.rst b/docs/ai/javascript.rst index e1822023cef..fc5e7f6305f 100644 --- a/docs/ai/javascript.rst +++ b/docs/ai/javascript.rst @@ -41,7 +41,7 @@ model): }); You may use any of the supported :ref:`text generation models -`. Add your query as context: +`. Add your query as context: .. code-block:: typescript diff --git a/docs/ai/reference_extai.rst b/docs/ai/reference_extai.rst index 6772964acd3..b7d11d61234 100644 --- a/docs/ai/reference_extai.rst +++ b/docs/ai/reference_extai.rst @@ -67,6 +67,8 @@ Providers tab ------------- +.. _ref_ai_extai_reference_index: + Index ===== @@ -105,6 +107,59 @@ Parameters: * ``dimensions``: int64 (Optional) - Embedding dimensions * ``truncate_to_max``: bool (Default: False) + +Built-in resources +================== + +.. _ref_ai_extai_reference_embedding_models: + +Embedding models +---------------- + +**OpenAI** + +* ``text-embedding-3-small`` +* ``text-embedding-3-large`` +* ``text-embedding-ada-002`` + +`Learn more about the OpenAI embedding models `__ + +**Mistral** + +* ``mistral-embed`` + +`Learn more about the Mistral embedding model `__ + + +.. _ref_ai_extai_reference_text_generation_models: + +Text generation models +---------------------- + +**OpenAI** + +* ``gpt-3.5-turbo`` +* ``gpt-4-turbo-preview`` + +`Learn more about the OpenAI text generation models `__ + +**Mistral** + +* ``mistral-small-latest`` +* ``mistral-medium-latest`` +* ``mistral-large-latest`` + +`Learn more about the Mistral text generation models `__ + +**Anthropic** + +* ``claude-3-haiku-20240307`` +* ``claude-3-sonnet-20240229`` +* ``claude-3-opus-20240229`` + +`Learn more about the Athropic text generation models `__ + + Functions ========= @@ -170,7 +225,8 @@ Functions query: array \ ) -> optional tuple - Searches objects using their :ref:`ai::index `. + Searches objects using their :ref:`ai::index + `. Returns tuples of (object, distance). @@ -257,10 +313,10 @@ Provider-Specific Types Each inherits from ``ProviderConfig`` with provider-specific defaults. Model Types ----------- +----------- ext::ai::Model -^^^^^^^^^^^^^ +^^^^^^^^^^^^^^ Abstract base type for AI models. Annotations: @@ -268,7 +324,7 @@ Annotations: * ``model_provider`` - Provider identifier ext::ai::EmbeddingModel -^^^^^^^^^^^^^^^^^^^^^^ +^^^^^^^^^^^^^^^^^^^^^^^ Abstract type for embedding models. Annotations: @@ -278,17 +334,17 @@ Annotations: * ``embedding_model_supports_shortening`` - Input shortening support flag ext::ai::TextGenerationModel -^^^^^^^^^^^^^^^^^^^^^^^^^^ +^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Abstract type for text generation models. Annotations: * ``text_gen_model_context_window`` - Model's context window size Indexing Types -------------- +-------------- ext::ai::DistanceFunction -^^^^^^^^^^^^^^^^^^^^^^^^ +^^^^^^^^^^^^^^^^^^^^^^^^^ Enum for similarity metrics: * ``Cosine`` @@ -296,7 +352,7 @@ Enum for similarity metrics: * ``L2`` ext::ai::IndexType -^^^^^^^^^^^^^^^^^ +^^^^^^^^^^^^^^^^^^ Enum for index implementations: * ``HNSW`` @@ -320,7 +376,7 @@ Example custom prompt configuration: }; ext::ai::ChatParticipantRole -^^^^^^^^^^^^^^^^^^^^^^^^^^^ +^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Enum for chat participants: * ``System`` @@ -329,7 +385,7 @@ Enum for chat participants: * ``Tool`` ext::ai::ChatPromptMessage -^^^^^^^^^^^^^^^^^^^^^^^^ +^^^^^^^^^^^^^^^^^^^^^^^^^^ Type for chat prompt messages. Properties: @@ -338,7 +394,7 @@ Properties: * ``content``: str (Required) ext::ai::ChatPrompt -^^^^^^^^^^^^^^^^^ +^^^^^^^^^^^^^^^^^^^ Type for chat prompt configuration. Properties: diff --git a/docs/ai/reference_http.rst b/docs/ai/reference_http.rst index 690fd38b27c..44d86a95bd4 100644 --- a/docs/ai/reference_http.rst +++ b/docs/ai/reference_http.rst @@ -25,7 +25,7 @@ Generates text embeddings using the specified embeddings model. Request headers --------------- -* `Content-Type: application/json` (required) +* ``Content-Type: application/json`` (required) Request body @@ -45,7 +45,7 @@ Request body * ``model`` (string, required): The name of the embedding model to use. You may use any of the supported :ref:`embedding models - `. + `. Example request @@ -118,9 +118,8 @@ search. Request headers --------------- -* `Content-Type: application/json` (required) +* ``Content-Type: application/json`` (required) -``` Request body ------------ @@ -163,32 +162,6 @@ Request body * ``model`` (string, required): The name of the text generation model to use. - .. _ref_ai_reference_text_generation_models: - - List of supported text generation models: - - **OpenAI** - - * ``gpt-3.5-turbo`` - * ``gpt-4-turbo-preview`` - - `Learn more about the OpenAI text generation models `__ - - **Mistral** - - * ``mistral-small-latest`` - * ``mistral-medium-latest`` - * ``mistral-large-latest`` - - `Learn more about the Mistral text generation models `__ - - **Anthropic** - - * ``claude-3-haiku-20240307`` - * ``claude-3-sonnet-20240229`` - * ``claude-3-opus-20240229`` - - `Learn more about the Athropic text generation models `__ * ``query`` (string, required): The query string use as the basis for text generation. diff --git a/docs/ai/reference_python.rst b/docs/ai/reference_python.rst index 3f0409731e3..872969ec693 100644 --- a/docs/ai/reference_python.rst +++ b/docs/ai/reference_python.rst @@ -230,7 +230,7 @@ GelAI Generates embeddings for input texts. - :param *inputs: + :param inputs: Input texts. :param model: The embedding model to use @@ -283,10 +283,11 @@ AsyncGelAI instance. .. py:method:: generate_embeddings(*inputs: str, model: str) -> list[float] + :noindex: Generates embeddings for input texts. - :param *inputs: + :param inputs: Input texts. :param model: The embedding model to use diff --git a/docs/datamodel/extensions.rst b/docs/datamodel/extensions.rst index 53a4ab6d932..0b1768fc592 100644 --- a/docs/datamodel/extensions.rst +++ b/docs/datamodel/extensions.rst @@ -21,7 +21,7 @@ There are a few built-in extensions available: - ``edgeql_http``: enables :ref:`EdgeQL over HTTP `, - ``graphql``: enables :ref:`GraphQL `, - ``auth``: enables :ref:`Gel Auth `, -- ``ai``: enables :ref:`ext::ai module `, +- ``ai``: enables :ref:`ext::ai module `, - ``pg_trgm``: enables ``ext::pg_trgm``, which re-exports `pgtrgm `__,