Closed ionflow closed 4 months ago
I will look into this
class Priority(Enum):
LOW = "low"
NORMAL = "normal"
HIGH = "high"
class TaskType(BaseModel):
name: str
description: str
class TaskDetails(BaseModel):
title: str
priority: Priority
due_date: str
subtasks: list[str]
tags: set[str]
metadata: dict[str, Any]
related_tasks: tuple[TaskType, ...]
assignee: Optional[str]
class TaskExtractor(AnthropicExtractor[TaskDetails]):
extract_schema: type[TaskDetails] = TaskDetails
prompt_template = """
Please extract the task details from the following description:
{task}
"""
task: str
call_params = AnthropicCallParams(model="anthropic.claude-3-haiku-20240307-v1:0")
configuration = BaseConfig(
client_wrappers=[
bedrock_client_wrapper(
aws_secret_key=os.getenv("AWS_SECRET_ACCESS_KEY"),
aws_access_key=os.getenv("AWS_ACCESS_KEY_ID"),
aws_region="us-west-2",
)
]
)
task_description = """
Submit the quarterly financial report by next Friday. This task is of high priority.
Subtasks:
- Gather financial data
- Prepare charts and graphs
- Write executive summary
Tags: finance, reporting, Q2
Metadata:
- Department: Accounting
- Fiscal Year: 2023
Related tasks:
- Task 1:
Name: Review previous quarter's report
Description: Analyze the previous quarter's financial report for comparison
- Task 2:
Name: Schedule board meeting
Description: Arrange a meeting with the board to present the quarterly report
Assignee: John Doe
"""
task = TaskExtractor(task=task_description).extract(retries=3)
assert isinstance(task, TaskDetails)
print(task.model_dump())
# > {'title': 'Submit the quarterly financial report', 'priority': <Priority.HIGH: 'high'>, 'due_date': 'next Friday', 'subtasks': ['Gather financial data', 'Prepare charts and graphs', 'Write executive summary'], 'tags': {'reporting', 'Q2', 'finance'}, 'metadata': {'Department': 'Accounting', 'Fiscal Year': 2023}, 'related_tasks': ({'name': "Review previous quarter's report", 'description': "Analyze the previous quarter's financial report for comparison"}, {'name': 'Schedule board meeting', 'description': 'Arrange a meeting with the board to present the quarterly report'}), 'assignee': 'John Doe'}
This is fixed in v0.17 :)
Description
I'm following this example here (but with an extractor): https://docs.mirascope.io/latest/concepts/supported_llm_providers/?h=bedrock#using-models-hosted-on-major-cloud-providers
I get this error:
AttributeError 'AnthropicBedrock' object has no attribute 'beta'
Python, Mirascope & OS Versions, related packages (not required)
mirascope = {extras = ["all"], version = "^0.16.1"}