# validate_company_name

Extracts company name from conversation, detecting legal suffixes and trade names.

## config

- type: extraction
- version: 1.0
- languages: pt-BR, en-US, es-ES
- endpoint: /v1/extract/company-name
- mcp_tool: nalu_extract_company_name
- mcp_description: Extracts company name from conversation. Detects legal suffixes (LTDA, ME, S/A, LLC, Inc, GmbH, etc.) and separates the clean name from the suffix. Returns company_name, suffix, and clean_name. Works for any country with special handling for Brazilian company suffixes.

## deterministic_rules

### stop_words
#### pt-BR
não sei, não lembro, bom dia, boa tarde, olá, oi, pessoa física, autônomo, sem empresa

#### en-US
i don't know, i don't remember, hello, hi, no company, individual, freelancer

#### es-ES
no sé, no recuerdo, hola, persona física, autónomo, sin empresa

### reject_patterns
- ^(sim|não|yes|no|sí|ok)$
- ^[0-9\s\.\-]+$

### accept_patterns
- (\b\w[\w\s\.&,'-]{2,}(?:ltda|me|epp|eireli|s[/\.]?a|sa|llc|inc|corp|ltd|gmbh|bv|srl|sl)\b)
- (\b[A-Z][a-zA-Z\s&,'-]{3,}\b)

### constraints
- min_length: 3
- must_have_alpha: true

## prompt

You are a company name extractor. Given the dialogue below, extract the company name.

Rules:
1. Extract the full company name including legal suffix (LTDA, LLC, Inc, etc.) if present.
2. Separate the clean name from the suffix.
3. Capitalize properly (Title Case for most names, preserve ALL CAPS if that appears intentional).
4. Remove context phrases: "a empresa", "a firma", "o nome é", "the company is", "trabajo en", etc.
5. Recognized suffixes: LTDA, ME, EPP, EIRELI, S/A, S.A., SA, LLC, Inc, Corp, Ltd, GmbH, BV, SRL, SL.
6. If the user gave an informal reference ("trabalho na tech solutions"), extract "Tech Solutions".
7. If no company name was provided, return extracted_value: null.

Dialogue:
Agent: {{agent_input}}
User: {{user_input}}

Agent context: {{agent_context}}

Reply ONLY with valid JSON, no markdown:
{
  "extracted_value": "{\"company_name\":\"Full Name Ltda\",\"suffix\":\"LTDA\",\"clean_name\":\"Full Name\"}",
  "certain": true/false,
  "reasoning": "short explanation"
}

## few_shot_examples

### example 1
- agent_input: What's the company name?
- user_input: Tech Solutions Ltda
- output: {"extracted_value": "{\"company_name\":\"Tech Solutions Ltda\",\"suffix\":\"LTDA\",\"clean_name\":\"Tech Solutions\"}", "certain": true, "reasoning": "Company name with Brazilian suffix LTDA"}

### example 2
- agent_input: Qual a empresa?
- user_input: trabalho na tech solutions
- output: {"extracted_value": "{\"company_name\":\"Tech Solutions\",\"suffix\":null,\"clean_name\":\"Tech Solutions\"}", "certain": true, "reasoning": "Company name extracted from informal sentence"}

### example 3
- agent_input: Company name?
- user_input: Acme Corporation Inc.
- output: {"extracted_value": "{\"company_name\":\"Acme Corporation Inc.\",\"suffix\":\"INC\",\"clean_name\":\"Acme Corporation\"}", "certain": true, "reasoning": "US company with Inc suffix"}

### example 4
- agent_input: Nome da empresa?
- user_input: ah deixa pra lá
- output: {"extracted_value": null, "certain": false, "reasoning": "User refused to provide company name"}

### example 5
- agent_input: What is your company's name?
- user_input: GlobalTech GmbH
- output: {"extracted_value": "{\"company_name\":\"GlobalTech GmbH\",\"suffix\":\"GMBH\",\"clean_name\":\"GlobalTech\"}", "certain": true, "reasoning": "German GmbH suffix detected"}

## suggestions

### when_null_evasive
#### pt-BR
Preciso do nome da empresa para continuar. Qual é o nome? (Ex: Tech Solutions Ltda)

#### en-US
I need the company name to continue. What's the company's name? (e.g. Tech Solutions Inc.)

#### es-ES
Necesito el nombre de la empresa para continuar. ¿Cuál es? (Ej: Tech Solutions S.L.)

### when_uncertain
#### pt-BR
O nome da empresa é {{company_name}}? Pode confirmar?

#### en-US
The company name is {{company_name}}? Can you confirm?

#### es-ES
¿El nombre de la empresa es {{company_name}}? ¿Puedes confirmar?
