Class PromptQueryEntity


  • @Entity
    public class PromptQueryEntity
    extends Object
    JPA entity for a prompt query configuration. It contains the configuration for a particular query, e.g. as the prompt message and fine-tuning parameters such as the temperature or seed value. A prompt query is always associated with a PromptConnectionEntity that is used when the query is executed.

    Since we wish to support various different prompt service providers with different configuration, this entity simply stores a map of custom properties. The actual interpretation of these properties is left to the prompt service provider implementations.

    Since:
    8.5.0
    • Constructor Detail

      • PromptQueryEntity

        public PromptQueryEntity()
    • Method Detail

      • addFile

        public void addFile​(PromptQueryFileEntity file)
        Adds the given file to this base entity.
        Parameters:
        file - to add
      • getAssignee

        public long getAssignee()
        Gets the ID of the assignee who owns this prompt query, i.e. a tenant or project. Null for the system scope.
        Returns:
        The ID of the assignee.
      • setAssignee

        public void setAssignee​(long assignee)
        Sets the ID of the assignee who owns this prompt query, i.e. a tenant or project. Null for the system scope.
        Parameters:
        assignee - The ID of the assignee.
      • getAssigneeKind

        public String getAssigneeKind()
        Gets the kind of the assignee who owns this prompt query, i.e. a tenant or project.
        Returns:
        The kind of the assignee.
      • setAssigneeKind

        public void setAssigneeKind​(String assigneeKind)
        Sets the kind of the assignee who owns this prompt query, i.e. a tenant or project.
        Parameters:
        assigneeKind - The kind of the assignee.
      • getConnection

        public PromptConnectionEntity getConnection()
        Gets the connection to use when executing this prompt query.
        Returns:
        The connection to use.
      • setConnection

        public void setConnection​(PromptConnectionEntity connection)
        Sets the connection to use when executing this prompt query.
        Parameters:
        connection - The new connection to set.
      • getCustomProperties

        public Map<String,​String> getCustomProperties()
        Sets the custom plain text properties of this prompt query. These are stored as key-value pairs in the database. Implementations may deserialize these properties into a more complex structure. Use getCustomPropertiesModel() to get the raw JSON data.
        Returns:
        The custom properties map.
      • setCustomProperties

        public void setCustomProperties​(Map<String,​String> customProperties)
        Sets the custom plain text properties of this prompt query. These are stored as key-value pairs in the database. Implementations may deserialize these properties into a more complex structure. Use getCustomPropertiesModel() to get the raw JSON data.
        Parameters:
        customProperties - The new custom properties map to set.
      • getCustomPropertiesModel

        public Map<String,​List<String>> getCustomPropertiesModel()
        Gets the parsed custom properties model of this prompt query, as a multivalued map where each key can have multiple values.
        Returns:
        The custom properties model as a JSON object map.
      • setCustomPropertiesModel

        public void setCustomPropertiesModel​(Map<String,​List<String>> newCustomProperties)
        Sets the custom properties model of this prompt query, which is a multivalued map where each key can have multiple values. This will replace any existing custom properties.
        Parameters:
        newCustomProperties - The new custom properties model to set.
      • getDescription

        public String getDescription()
        Gets the internal description of this prompt description, visible only to backend users.
        Returns:
        The description.
      • setDescription

        public void setDescription​(String description)
        Sets the internal description of this prompt description, visible only to backend users.
        Parameters:
        description - The new description to set.
      • getFile

        public PromptQueryFileEntity getFile​(String fileKey,
                                             int fileIndex)
        Gets the file with the given key and index.
        Parameters:
        fileKey - key of the file
        fileIndex - index of the file
        Returns:
        the file with the given key and index or null if no such file exists.
      • getFiles

        public List<PromptQueryFileEntity> getFiles()
        Gets the list of files that are part of this prompt query's configuration, such as images or documents. Which files can be configured depends on the type of the prompt connection.
        Returns:
        The list of files.
      • setFiles

        public void setFiles​(List<PromptQueryFileEntity> files)
        Sets the list of files that are part of this prompt query's configuration, such as images or documents. Which files can be configured depends on the type of the prompt connection.
        Parameters:
        files - The new list of files to set.
      • getId

        public Long getId()
        Gets the unique database ID of this prompt query. The database ID is unique within the system, across all tenants.
        Returns:
        The database ID of this prompt query.
      • setId

        public void setId​(Long id)
        Sets the unique database ID of this prompt query. The database ID is unique within the system, across all tenants.
        Parameters:
        id - The database ID of this prompt query.
      • getLockingVersion

        public int getLockingVersion()
        Gets the locking version for optimistic locking.
        Returns:
        The locking version.
      • setLockingVersion

        public void setLockingVersion​(int lockingVersion)
        Sets the locking version for optimistic locking.
        Parameters:
        lockingVersion - The new locking version.
      • getName

        public String getName()
        Gets the technical name of this prompt connection. The name can be configured in the backend by the user.
        Returns:
        The technical name.
      • setName

        public void setName​(String name)
        Sets the technical name of this prompt connection. The name can be configured in the backend by the user.
        Parameters:
        name - The new technical name to set.
      • getUuid

        public UUID getUuid()
        Gets the UUID of this prompt query. The UUID is unique within the tenant.
        Returns:
        The UUID.
      • setUuid

        public void setUuid​(UUID uuid)
        Sets the unique UUID of this prompt query. The UUID is unique within the tenant.
        Parameters:
        uuid - The new UUID.
      • removeFile

        public void removeFile​(PromptQueryFileEntity file)
        Removes the given file from this base entity.
        Parameters:
        file - to remove