HomeGuidesAPI ReferenceRelease notes
Log In
Guides

Correct language

Correct Language allows users to explicitly define the set of allowed languages (which can be more than one) either by supplying the list of valid languages (include) or by specifying the ones to exclude. The detection algorithm will always classify the given text into one language only, even if the sentence is written in more than one language.

Using the SDK

from superwise_api.models.agent.agent import AgentCorrectLanguageGuard

restricted_topics_guard = AgentCorrectLanguageGuard(
    name="Rule name",
    tags={"input", "output"}, # A Set containing "input", "output", or both
    language_codes=["en", "fr"], # In ISO format
    filter_mode="include" # or - "exclude"
)