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>"
  ]
}

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

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