{"id":20226796,"url":"https://github.com/aastroza/chatstract","last_synced_at":"2026-05-13T02:32:07.461Z","repository":{"id":239369098,"uuid":"796874665","full_name":"aastroza/chatstract","owner":"aastroza","description":"Progressively extracts structured information from multi-turn user chats using pydantic schemas and LLMs","archived":false,"fork":false,"pushed_at":"2024-05-13T00:11:58.000Z","size":18,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-10T13:56:51.550Z","etag":null,"topics":["instructor","llm","llms","openai","pydantic-v2","structured-generation"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aastroza.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-05-06T19:31:02.000Z","updated_at":"2025-01-22T09:26:17.000Z","dependencies_parsed_at":"2024-05-11T22:22:34.804Z","dependency_job_id":"c44105ee-985d-433b-a81e-8d0a4735302c","html_url":"https://github.com/aastroza/chatstract","commit_stats":null,"previous_names":["aastroza/chatstract"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/aastroza/chatstract","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aastroza%2Fchatstract","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aastroza%2Fchatstract/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aastroza%2Fchatstract/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aastroza%2Fchatstract/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aastroza","download_url":"https://codeload.github.com/aastroza/chatstract/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aastroza%2Fchatstract/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32965213,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-12T23:30:32.555Z","status":"online","status_checked_at":"2026-05-13T02:00:07.132Z","response_time":115,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["instructor","llm","llms","openai","pydantic-v2","structured-generation"],"created_at":"2024-11-14T07:20:18.782Z","updated_at":"2026-05-13T02:32:07.443Z","avatar_url":"https://github.com/aastroza.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# chatstract\n\n**Chatstract** is a tool that progressively extracts structured information from multi-turn user chats using pydantic schemas and LLMs. Powered by [Instructor](https://github.com/jxnl/instructor/).\n\n## Basic Example\n\n[Code](examples/simple_model.py)\n\nFirst, create the pydantic model you wish to fill out through a conversational method.\n\n```python\nfrom datetime import date\nfrom pydantic import BaseModel, Field\nfrom typing import Optional\n\nclass Task(BaseModel):\n    title: str = Field(description=\"A short title of the task.\")\n    due_date: date = Field(description=\"The deadline for the task. Current year: 2024\")\n    responsable: str = Field(description=\"The person assigned to solve the task\")\n    location: str = Field(description=\"The location where the task will be performed\")\n    status: Optional[str] = Field(description=\"The status of the task\", default=None)\n```\n\nThen, use Chatstract to populate the data model with values from sequential messages provided by the user.\n\n```python\nfrom chatstract.core import Chat\n\nchat = Chat(data_model = Task)\n\nmessages = [\"Jason has to clean his desk\",\n            \"The deadline is september 7th\",\n            \"This task is for the Downtown office\",\n            \"I messed up, the task is for Dorothy at the Uptown office\",\n            \"The status for this task is 'Done'\"]\n\nfor message in messages:\n    info = chat.chat_ai(message)\n    print(f\"User message: {message}\")\n    print(f\"Data: {chat.data_values}\")\n    \n    if len(info.answer) == 0:\n        print(\"Missing information: None\")\n        print(\"Follow-up question: None\")\n        print(\"\\n===\\n\")\n        continue\n    \n    for question in info.answer:\n        print(f\"Missing information: {question.missing_information_key}\")\n        print(f\"Follow-up question: {question.question}\")\n\n    print(\"\\n===\\n\")\n```\n\nBelow is the output you can expect:\n\n```\nUser message: Jason has to clean his desk\nData: {'title': 'Clean the desk', 'due_date': None, 'responsable': 'Jason', 'location': None, 'status': None}\nMissing information: due_date\nFollow-up question: What is the due date for the task 'Clean the desk'?\nMissing information: location\nFollow-up question: Where should the task 'Clean the desk' be performed?\n\n===\n\nUser message: The deadline is september 7th\nData: {'title': 'Clean the desk', 'due_date': datetime.date(2024, 9, 7), 'responsable': 'Jason', 'location': None, 'status': None}\nMissing information: location\nFollow-up question: What is the location for the task 'Clean the desk'?\n\n===\n\nUser message: This task is for the Downtown office\nData: {'title': 'Clean the desk', 'due_date': datetime.date(2024, 9, 7), 'responsable': 'Jason', 'location': 'Downtown office', 'status': None}\nMissing information: None\nFollow-up question: None\n\n===\n\nUser message: I messed up, the task is for Dorothy at the Uptown office\nData: {'title': 'Clean the desk', 'due_date': datetime.date(2024, 9, 7), 'responsable': 'Dorothy', 'location': 'Uptown office', 'status': None}\nMissing information: None\nFollow-up question: None\n\n===\n\nUser message: The status for this task is 'Done'\nData: {'title': 'Clean the desk', 'due_date': datetime.date(2024, 9, 7), 'responsable': 'Dorothy', 'location': 'Uptown office', 'status': 'Done'}\nMissing information: None\nFollow-up question: None\n\n===\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faastroza%2Fchatstract","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faastroza%2Fchatstract","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faastroza%2Fchatstract/lists"}