Skip to main content
POST
/
suggest_regex
Python
import os
from unstructured import UnstructuredClient

client = UnstructuredClient(
    username=os.environ.get("UNSTRUCTURED_USERNAME"),  # This is the default and can be omitted
    password=os.environ.get("UNSTRUCTURED_PASSWORD"),  # This is the default and can be omitted
)
response = client.tags.pattern.suggest_patterns(
    pattern_description="pattern_description",
    tag_data={
        "name": "name"
    },
)
print(response.confidence_score)
{
  "regex": "<string>",
  "explanation": "<string>",
  "validation_results": {},
  "confidence_score": 123,
  "suggested_improvements": [
    "<string>"
  ],
  "context_items": [
    "<string>"
  ],
  "inferred_intent": "<string>",
  "required_context_matches": 123
}

Authorizations

Authorization
string
header
required

Basic authentication header of the form Basic <encoded-value>, where <encoded-value> is the base64-encoded string username:password.

Body

application/json
tag_data
Tag · object
required
pattern_description
string
required
examples
string[] | null
negative_examples
string[] | null
edge_case_context
string | null
positive_test_cases
TestCase · object[] | null
negative_test_cases
TestCase · object[] | null
validate_before_return
boolean
default:true
document_context
string | null
current_wrong_result
string | null
previous_attempts
Previous Attempts · object[] | null
context_type
string | null
context_payload
Context Payload · object
evidence_examples
EvidenceExample · object[] | null

Response

Successful Response

regex
string
required
explanation
string | null
validation_results
Validation Results · object
confidence_score
number | null
suggested_improvements
string[] | null
context_items
string[] | null
inferred_intent
string | null
required_context_matches
integer | null