"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""

from __future__ import annotations
from neuralseek.types import BaseModel
import pydantic
from typing import List, Optional
from typing_extensions import Annotated, NotRequired, TypedDict


class MetadataTypedDict(TypedDict):
    user_id: NotRequired[str]
    r"""A unique user identifier."""


class Metadata(BaseModel):
    user_id: Optional[str] = ""
    r"""A unique user identifier."""


class SystemTypedDict(TypedDict):
    session_id: NotRequired[str]
    r"""A session identifier for the defined user."""


class System(BaseModel):
    session_id: Optional[str] = ""
    r"""A session identifier for the defined user."""


class UserSessionTypedDict(TypedDict):
    r"""Context tracking object. You must set at least one of user_id or session_id to enable context keeping."""

    metadata: NotRequired[MetadataTypedDict]
    system: NotRequired[SystemTypedDict]


class UserSession(BaseModel):
    r"""Context tracking object. You must set at least one of user_id or session_id to enable context keeping."""

    metadata: Optional[Metadata] = None

    system: Optional[System] = None


class ParamsTypedDict(TypedDict):
    name: NotRequired[str]
    r"""The parameter name"""
    value: NotRequired[str]
    r"""The parameter value"""


class Params(BaseModel):
    name: Optional[str] = ""
    r"""The parameter name"""

    value: Optional[str] = ""
    r"""The parameter value"""


class PersonalizeTypedDict(TypedDict):
    r"""An object that allows NeuralSeek to tailor a response for a specific user"""

    preferred_name: NotRequired[str]
    r"""The name the user should be referred to by"""
    no_welcome: NotRequired[str]
    r"""The user has already been welcomed, do not re-welcome.  Valid value is 'true' or 'false'.  Default value is 'false'."""
    force_first_person: NotRequired[str]
    r"""Use a first-person speaking style, even if no preferredName is set.  Valid value is 'true' or 'false'.  Default value is 'false'."""
    products: NotRequired[List[str]]
    r"""An array of products this customer currently consumes from your company"""
    additional_details: NotRequired[str]
    r"""Additional details to pass to language generation"""


class Personalize(BaseModel):
    r"""An object that allows NeuralSeek to tailor a response for a specific user"""

    preferred_name: Annotated[Optional[str], pydantic.Field(alias="preferredName")] = ""
    r"""The name the user should be referred to by"""

    no_welcome: Annotated[Optional[str], pydantic.Field(alias="noWelcome")] = ""
    r"""The user has already been welcomed, do not re-welcome.  Valid value is 'true' or 'false'.  Default value is 'false'."""

    force_first_person: Annotated[
        Optional[str], pydantic.Field(alias="forceFirstPerson")
    ] = ""
    r"""Use a first-person speaking style, even if no preferredName is set.  Valid value is 'true' or 'false'.  Default value is 'false'."""

    products: Optional[List[str]] = None
    r"""An array of products this customer currently consumes from your company"""

    additional_details: Annotated[
        Optional[str], pydantic.Field(alias="additionalDetails")
    ] = ""
    r"""Additional details to pass to language generation"""


class LastTurnTypedDict(TypedDict):
    input: NotRequired[str]
    r"""The user input"""
    response: NotRequired[str]
    r"""The system response.  Text strings only here."""


class LastTurn(BaseModel):
    input: Optional[str] = ""
    r"""The user input"""

    response: Optional[str] = ""
    r"""The system response.  Text strings only here."""


class OptionsTypedDict(TypedDict):
    r"""Optional object for runtime override of Seek options."""

    personalize: NotRequired[PersonalizeTypedDict]
    r"""An object that allows NeuralSeek to tailor a response for a specific user"""
    proposal_id: NotRequired[str]
    r"""Override all settings by passing a NeuralSeek Proposal ID."""
    streaming: NotRequired[bool]
    r"""Return the response via SSE streaming.  This is not compatible with most Virtual Agent platforms, and is intentded for direct website use."""
    seek_llm: NotRequired[str]
    r"""Override the LLM load balancer and force seek to use a specific LLM.  Input the LLM code here.  You must have a valid model card set up on the configure tab for the code you input."""
    language: NotRequired[str]
    r"""Valid values are: en, es, de, it, fr, ja, ar"""
    filter_: NotRequired[str]
    r"""Text to use as a filter against the filter field set in the KnowledgeBase configuration. Use commas to separate multiple strings for an 'or' filter. You can use the filter to isolate a certain subset of documents in the knowledgebase."""
    last_turn: NotRequired[List[LastTurnTypedDict]]
    r"""lastTurn is a flexible object. It is backwards compatible with the original single turn object, as well as compatible with the Watson Assistant session history format."""
    prompt_engineering: NotRequired[str]
    r"""Enable Prompt engineering.  Valid values are the strings 'true' and 'false'"""
    prompt_engineering_phrase: NotRequired[str]
    r"""Prepend a phrase to cleansed user input. Must enable Prompt Engineering inside the NeuralSeek \"Configure\" page"""
    answer_length: NotRequired[int]
    r"""The verbosity of the answer. A whole number 1-4"""
    url: NotRequired[str]
    r"""URL of the current page when using with a web-based Virtual Agent"""
    stump: NotRequired[str]
    r"""Stump Speech text. Fallback for when all else fails."""
    include_source_results: NotRequired[bool]
    r"""Include generation source results. Defaults to false."""
    include_highlights: NotRequired[bool]
    r"""Include highlights from source results. Defaults to false."""
    include_source_results_formatted: NotRequired[bool]
    r"""Include generation source results, and output them into a formatted string.  Defaults to false."""
    source_results_number: NotRequired[int]
    r"""When including source results, how many to include.'"""
    source_results_summary_length: NotRequired[int]
    r"""When including source results, how long of a summary to include.'"""
    return_variables: NotRequired[bool]
    r"""Return the final state of all variables in a dense object"""
    return_variables_expanded: NotRequired[bool]
    r"""Return the final state of all variables in the same format as the input params"""


class Options(BaseModel):
    r"""Optional object for runtime override of Seek options."""

    personalize: Optional[Personalize] = None
    r"""An object that allows NeuralSeek to tailor a response for a specific user"""

    proposal_id: Annotated[Optional[str], pydantic.Field(alias="proposalID")] = ""
    r"""Override all settings by passing a NeuralSeek Proposal ID."""

    streaming: Optional[bool] = False
    r"""Return the response via SSE streaming.  This is not compatible with most Virtual Agent platforms, and is intentded for direct website use."""

    seek_llm: Annotated[Optional[str], pydantic.Field(alias="seekLLM")] = ""
    r"""Override the LLM load balancer and force seek to use a specific LLM.  Input the LLM code here.  You must have a valid model card set up on the configure tab for the code you input."""

    language: Optional[str] = ""
    r"""Valid values are: en, es, de, it, fr, ja, ar"""

    filter_: Annotated[Optional[str], pydantic.Field(alias="filter")] = ""
    r"""Text to use as a filter against the filter field set in the KnowledgeBase configuration. Use commas to separate multiple strings for an 'or' filter. You can use the filter to isolate a certain subset of documents in the knowledgebase."""

    last_turn: Annotated[Optional[List[LastTurn]], pydantic.Field(alias="lastTurn")] = (
        None
    )
    r"""lastTurn is a flexible object. It is backwards compatible with the original single turn object, as well as compatible with the Watson Assistant session history format."""

    prompt_engineering: Annotated[
        Optional[str], pydantic.Field(alias="promptEngineering")
    ] = ""
    r"""Enable Prompt engineering.  Valid values are the strings 'true' and 'false'"""

    prompt_engineering_phrase: Annotated[
        Optional[str], pydantic.Field(alias="promptEngineeringPhrase")
    ] = ""
    r"""Prepend a phrase to cleansed user input. Must enable Prompt Engineering inside the NeuralSeek \"Configure\" page"""

    answer_length: Annotated[Optional[int], pydantic.Field(alias="answerLength")] = None
    r"""The verbosity of the answer. A whole number 1-4"""

    url: Optional[str] = ""
    r"""URL of the current page when using with a web-based Virtual Agent"""

    stump: Optional[str] = ""
    r"""Stump Speech text. Fallback for when all else fails."""

    include_source_results: Annotated[
        Optional[bool], pydantic.Field(alias="includeSourceResults")
    ] = False
    r"""Include generation source results. Defaults to false."""

    include_highlights: Annotated[
        Optional[bool], pydantic.Field(alias="includeHighlights")
    ] = False
    r"""Include highlights from source results. Defaults to false."""

    include_source_results_formatted: Annotated[
        Optional[bool], pydantic.Field(alias="includeSourceResultsFormatted")
    ] = False
    r"""Include generation source results, and output them into a formatted string.  Defaults to false."""

    source_results_number: Annotated[
        Optional[int], pydantic.Field(alias="sourceResultsNumber")
    ] = 3
    r"""When including source results, how many to include.'"""

    source_results_summary_length: Annotated[
        Optional[int], pydantic.Field(alias="sourceResultsSummaryLength")
    ] = 100
    r"""When including source results, how long of a summary to include.'"""

    return_variables: Annotated[
        Optional[bool], pydantic.Field(alias="returnVariables")
    ] = False
    r"""Return the final state of all variables in a dense object"""

    return_variables_expanded: Annotated[
        Optional[bool], pydantic.Field(alias="returnVariablesExpanded")
    ] = False
    r"""Return the final state of all variables in the same format as the input params"""


class SeekTypedDict(TypedDict):
    question: NotRequired[str]
    r"""The user's question for NeuralSeek"""
    user_session: NotRequired[UserSessionTypedDict]
    r"""Context tracking object. You must set at least one of user_id or session_id to enable context keeping."""
    params: NotRequired[List[ParamsTypedDict]]
    r"""An array of parameters to use in evaluation of the seek when calling mAIstro during a seek."""
    options: NotRequired[OptionsTypedDict]
    r"""Optional object for runtime override of Seek options."""


class Seek(BaseModel):
    question: Optional[str] = ""
    r"""The user's question for NeuralSeek"""

    user_session: Optional[UserSession] = None
    r"""Context tracking object. You must set at least one of user_id or session_id to enable context keeping."""

    params: Optional[List[Params]] = None
    r"""An array of parameters to use in evaluation of the seek when calling mAIstro during a seek."""

    options: Optional[Options] = None
    r"""Optional object for runtime override of Seek options."""
