sarvamai-go SDK Documentation
Text

DetectLanguage

`Text.DetectLanguage` for language and script identification.

Signature

func (c *TextClient) DetectLanguage(ctx context.Context, input string) (*DetectLanguageResponse, error)

Validation rules

  • input must be non-empty
  • max length is 1000 characters

Response

FieldType
RequestID*string
LanguageCode*string
ScriptCode*ScriptCode

Example

resp, err := client.Text.DetectLanguage(ctx, "नमस्ते")
if err != nil {
    panic(err)
}

fmt.Println(*resp.LanguageCode, *resp.ScriptCode)

On this page