Dates
date_range_search
date_range_search(search_term, content, metadata=None, image_url=None, max_characters=8000, api_key=None, azure_endpoint=None, api_version=None, model=None, max_retries=5)
Searches a document to find a date range matching the input query. Returns date ranges in ISO format (e.g. "2024-01-15 to 2024-02-28").
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
search_term
|
str
|
The search query to find date ranges in the document |
required |
content
|
str
|
The main body text of the document to search through |
required |
metadata
|
dict | None
|
Optional additional information describing the content context |
None
|
image_url
|
str | None
|
Optional signed or public URL where an image can be found for analysis |
None
|
max_characters
|
int
|
Maximum number of text characters (excluding images) from |
8000
|
api_key
|
str | None
|
Access key for the Azure OpenAI resource |
None
|
azure_endpoint
|
str | None
|
Your Azure endpoint URL, including the resource
(e.g. https://example-resource.azure.openai.com/). If not provided,
defaults to environment variable |
None
|
api_version
|
str | None
|
API version for the Azure OpenAI resource |
None
|
model
|
str | None
|
Model deployment name within the Azure resource. If not provided,
defaults to environment variable |
None
|
max_retries
|
int
|
Maximum number of unsuccessful call attempts to the OpenAI service before returning an error. |
5
|
Returns:
| Type | Description |
|---|---|
str
|
Date range matching the query in ISO format (e.g. "2024-01-15 to 2024-02-28"), or empty string if no valid date range is found. |
Examples:
>>> date_range_search("project timeline", "The project runs from 15-Jan-2024 to 28-Feb-2024")
"2024-01-15 to 2024-02-28"
>>> date_range_search("vacation dates", "I'll be away from 5-Jul to 12-Jul")
"5-Jul to 12-Jul"
date_search
date_search(search_term, content, metadata=None, image_url=None, max_characters=8000, api_key=None, azure_endpoint=None, api_version=None, model=None, max_retries=5)
Searches a document to find a date matching the input query. Returns dates in ISO format (YYYY-MM-DD).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
search_term
|
str
|
The search query |
required |
content
|
str
|
The main-body of the prompt |
required |
metadata
|
dict | None
|
Any additional information describing the content |
None
|
image_url
|
str | None
|
A signed or public URL where an image can be found |
None
|
max_characters
|
int
|
Maximum number of text characters (excluding images) from |
8000
|
api_key
|
str | None
|
Access key for the Azure OpenAI resource |
None
|
azure_endpoint
|
str | None
|
Your Azure endpoint, including the resource, e.g. https://example-resource.azure.openai.com/. if not provided will default to environment variable |
None
|
api_version
|
str | None
|
API version for Azure resource. |
None
|
model
|
str | None
|
Model deployment name within the Azure resource. If not provided will default to environment variable |
None
|
max_retries
|
int
|
Maximum number of unsuccessful call attempts to the OpenAI service before returning an error. |
5
|
Returns:
| Type | Description |
|---|---|
str
|
Date matching the query in ISO format (e.g. "2024-01-15"), or empty string if no date found. |