chatterer 0.1.12__py3-none-any.whl → 0.1.13__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. chatterer/__init__.py +62 -60
  2. chatterer/common_types/__init__.py +21 -0
  3. chatterer/common_types/io.py +19 -0
  4. chatterer/language_model.py +577 -577
  5. chatterer/messages.py +9 -9
  6. chatterer/strategies/__init__.py +13 -13
  7. chatterer/strategies/atom_of_thoughts.py +975 -975
  8. chatterer/strategies/base.py +14 -14
  9. chatterer/tools/__init__.py +35 -28
  10. chatterer/tools/citation_chunking/__init__.py +3 -3
  11. chatterer/tools/citation_chunking/chunks.py +53 -53
  12. chatterer/tools/citation_chunking/citation_chunker.py +118 -118
  13. chatterer/tools/citation_chunking/citations.py +285 -285
  14. chatterer/tools/citation_chunking/prompt.py +157 -157
  15. chatterer/tools/citation_chunking/reference.py +26 -26
  16. chatterer/tools/citation_chunking/utils.py +138 -138
  17. chatterer/tools/convert_to_text.py +418 -463
  18. chatterer/tools/upstage_document_parser.py +438 -0
  19. chatterer/tools/webpage_to_markdown/__init__.py +4 -4
  20. chatterer/tools/webpage_to_markdown/playwright_bot.py +649 -649
  21. chatterer/tools/webpage_to_markdown/utils.py +334 -334
  22. chatterer/tools/youtube.py +146 -146
  23. chatterer/utils/__init__.py +15 -15
  24. chatterer/utils/bytesio.py +59 -0
  25. chatterer/utils/code_agent.py +138 -138
  26. chatterer/utils/image.py +291 -291
  27. {chatterer-0.1.12.dist-info → chatterer-0.1.13.dist-info}/METADATA +171 -170
  28. chatterer-0.1.13.dist-info/RECORD +31 -0
  29. chatterer-0.1.12.dist-info/RECORD +0 -27
  30. {chatterer-0.1.12.dist-info → chatterer-0.1.13.dist-info}/WHEEL +0 -0
  31. {chatterer-0.1.12.dist-info → chatterer-0.1.13.dist-info}/top_level.txt +0 -0
@@ -1,170 +1,171 @@
1
- Metadata-Version: 2.4
2
- Name: chatterer
3
- Version: 0.1.12
4
- Summary: The highest-level interface for various LLM APIs.
5
- Requires-Python: >=3.12
6
- Description-Content-Type: text/markdown
7
- Requires-Dist: instructor>=1.7.2
8
- Requires-Dist: langchain>=0.3.19
9
- Provides-Extra: dev
10
- Requires-Dist: neo4j-extension>=0.1.14; extra == "dev"
11
- Requires-Dist: colorama>=0.4.6; extra == "dev"
12
- Requires-Dist: ipykernel>=6.29.5; extra == "dev"
13
- Provides-Extra: conversion
14
- Requires-Dist: markdownify>=1.1.0; extra == "conversion"
15
- Requires-Dist: commonmark>=0.9.1; extra == "conversion"
16
- Requires-Dist: playwright>=1.50.0; extra == "conversion"
17
- Requires-Dist: pillow>=11.1.0; extra == "conversion"
18
- Requires-Dist: mistune>=3.1.2; extra == "conversion"
19
- Requires-Dist: markitdown>=0.0.2; extra == "conversion"
20
- Requires-Dist: pymupdf>=1.25.4; extra == "conversion"
21
- Requires-Dist: youtube-transcript-api>=1.0.2; extra == "conversion"
22
- Provides-Extra: langchain
23
- Requires-Dist: chatterer[langchain-providers]; extra == "langchain"
24
- Requires-Dist: langchain-experimental>=0.3.4; extra == "langchain"
25
- Provides-Extra: langchain-providers
26
- Requires-Dist: langchain-openai>=0.3.7; extra == "langchain-providers"
27
- Requires-Dist: langchain-anthropic>=0.3.8; extra == "langchain-providers"
28
- Requires-Dist: langchain-google-genai>=2.0.10; extra == "langchain-providers"
29
- Requires-Dist: langchain-ollama>=0.2.3; extra == "langchain-providers"
30
- Provides-Extra: all
31
- Requires-Dist: chatterer[langchain]; extra == "all"
32
- Requires-Dist: chatterer[conversion]; extra == "all"
33
- Requires-Dist: chatterer[dev]; extra == "all"
34
-
35
- # Chatterer
36
-
37
- **Simplified, Structured AI Assistant Framework**
38
-
39
- `chatterer` is a Python library designed as a type-safe LangChain wrapper for interacting with various language models (OpenAI, Anthropic, Gemini, Ollama, etc.). It supports structured outputs via Pydantic models, plain text responses, and asynchronous calls.
40
-
41
- The structured reasoning in `chatterer` is inspired by the [Atom-of-Thought](https://github.com/qixucen/atom) pipeline.
42
-
43
- ---
44
-
45
- ## Quick Install
46
-
47
- ```bash
48
- pip install chatterer
49
- ```
50
-
51
- ---
52
-
53
- ## Quickstart Example
54
-
55
- Generate text quickly using OpenAI:
56
-
57
- ```python
58
- from chatterer import Chatterer
59
-
60
- chat = Chatterer.openai("gpt-4o-mini")
61
- response = chat.generate("What is the meaning of life?")
62
- print(response)
63
- ```
64
-
65
- Messages can be input as plain strings or structured lists:
66
-
67
- ```python
68
- response = chat.generate([{ "role": "user", "content": "What's 2+2?" }])
69
- print(response)
70
- ```
71
-
72
- ### Structured Output with Pydantic
73
-
74
- ```python
75
- from pydantic import BaseModel
76
-
77
- class AnswerModel(BaseModel):
78
- question: str
79
- answer: str
80
-
81
- response = chat.generate_pydantic(AnswerModel, "What's the capital of France?")
82
- print(response.question, response.answer)
83
- ```
84
-
85
- ### Async Example
86
-
87
- ```python
88
- import asyncio
89
-
90
- async def main():
91
- response = await chat.agenerate("Explain async in Python briefly.")
92
- print(response)
93
-
94
- asyncio.run(main())
95
- ```
96
-
97
- ---
98
-
99
- ## Atom-of-Thought Pipeline (AoT)
100
-
101
- `AoTPipeline` provides structured reasoning by:
102
-
103
- - Detecting question domains (general, math, coding, philosophy, multihop).
104
- - Decomposing questions recursively.
105
- - Generating direct, decomposition-based, and simplified answers.
106
- - Combining answers via ensemble.
107
-
108
- ### AoT Usage Example
109
-
110
- ```python
111
- from chatterer import Chatterer
112
- from chatterer.strategies import AoTStrategy, AoTPipeline
113
-
114
- pipeline = AoTPipeline(chatterer=Chatterer.openai(), max_depth=2)
115
- strategy = AoTStrategy(pipeline=pipeline)
116
-
117
- question = "What would Newton discover if hit by an apple falling from 100 meters?"
118
- answer = strategy.invoke(question)
119
- print(answer)
120
- ```
121
-
122
- ---
123
-
124
- ## Supported Models
125
-
126
- - **OpenAI**
127
- - **Anthropic**
128
- - **Google Gemini**
129
- - **Ollama** (local models)
130
-
131
- Initialize models easily:
132
-
133
- ```python
134
- openai_chat = Chatterer.openai("gpt-4o-mini")
135
- anthropic_chat = Chatterer.anthropic("claude-3-7-sonnet-20250219")
136
- gemini_chat = Chatterer.google("gemini-2.0-flash")
137
- ollama_chat = Chatterer.ollama("deepseek-r1:1.5b")
138
- ```
139
-
140
- ---
141
-
142
- ## Advanced Features
143
-
144
- - **Streaming responses**
145
- - **Async/Await support**
146
- - **Structured outputs with Pydantic models**
147
-
148
- ---
149
-
150
- ## Logging
151
-
152
- Built-in logging for easy debugging:
153
-
154
- ```python
155
- import logging
156
- logging.basicConfig(level=logging.DEBUG)
157
- ```
158
-
159
- ---
160
-
161
- ## Contributing
162
-
163
- Feel free to open an issue or pull request.
164
-
165
- ---
166
-
167
- ## License
168
-
169
- MIT License
170
-
1
+ Metadata-Version: 2.4
2
+ Name: chatterer
3
+ Version: 0.1.13
4
+ Summary: The highest-level interface for various LLM APIs.
5
+ Requires-Python: >=3.12
6
+ Description-Content-Type: text/markdown
7
+ Requires-Dist: instructor>=1.7.2
8
+ Requires-Dist: langchain>=0.3.19
9
+ Provides-Extra: dev
10
+ Requires-Dist: neo4j-extension>=0.1.14; extra == "dev"
11
+ Requires-Dist: colorama>=0.4.6; extra == "dev"
12
+ Requires-Dist: ipykernel>=6.29.5; extra == "dev"
13
+ Provides-Extra: conversion
14
+ Requires-Dist: markdownify>=1.1.0; extra == "conversion"
15
+ Requires-Dist: commonmark>=0.9.1; extra == "conversion"
16
+ Requires-Dist: playwright>=1.50.0; extra == "conversion"
17
+ Requires-Dist: pillow>=11.1.0; extra == "conversion"
18
+ Requires-Dist: mistune>=3.1.3; extra == "conversion"
19
+ Requires-Dist: markitdown>=0.1.1; extra == "conversion"
20
+ Requires-Dist: pymupdf>=1.25.4; extra == "conversion"
21
+ Requires-Dist: youtube-transcript-api>=1.0.3; extra == "conversion"
22
+ Requires-Dist: pypdf>=5.4.0; extra == "conversion"
23
+ Provides-Extra: langchain
24
+ Requires-Dist: chatterer[langchain-providers]; extra == "langchain"
25
+ Requires-Dist: langchain-experimental>=0.3.4; extra == "langchain"
26
+ Provides-Extra: langchain-providers
27
+ Requires-Dist: langchain-openai>=0.3.11; extra == "langchain-providers"
28
+ Requires-Dist: langchain-anthropic>=0.3.10; extra == "langchain-providers"
29
+ Requires-Dist: langchain-google-genai>=2.1.1; extra == "langchain-providers"
30
+ Requires-Dist: langchain-ollama>=0.3.0; extra == "langchain-providers"
31
+ Provides-Extra: all
32
+ Requires-Dist: chatterer[langchain]; extra == "all"
33
+ Requires-Dist: chatterer[conversion]; extra == "all"
34
+ Requires-Dist: chatterer[dev]; extra == "all"
35
+
36
+ # Chatterer
37
+
38
+ **Simplified, Structured AI Assistant Framework**
39
+
40
+ `chatterer` is a Python library designed as a type-safe LangChain wrapper for interacting with various language models (OpenAI, Anthropic, Gemini, Ollama, etc.). It supports structured outputs via Pydantic models, plain text responses, and asynchronous calls.
41
+
42
+ The structured reasoning in `chatterer` is inspired by the [Atom-of-Thought](https://github.com/qixucen/atom) pipeline.
43
+
44
+ ---
45
+
46
+ ## Quick Install
47
+
48
+ ```bash
49
+ pip install chatterer
50
+ ```
51
+
52
+ ---
53
+
54
+ ## Quickstart Example
55
+
56
+ Generate text quickly using OpenAI:
57
+
58
+ ```python
59
+ from chatterer import Chatterer
60
+
61
+ chat = Chatterer.openai("gpt-4o-mini")
62
+ response = chat.generate("What is the meaning of life?")
63
+ print(response)
64
+ ```
65
+
66
+ Messages can be input as plain strings or structured lists:
67
+
68
+ ```python
69
+ response = chat.generate([{ "role": "user", "content": "What's 2+2?" }])
70
+ print(response)
71
+ ```
72
+
73
+ ### Structured Output with Pydantic
74
+
75
+ ```python
76
+ from pydantic import BaseModel
77
+
78
+ class AnswerModel(BaseModel):
79
+ question: str
80
+ answer: str
81
+
82
+ response = chat.generate_pydantic(AnswerModel, "What's the capital of France?")
83
+ print(response.question, response.answer)
84
+ ```
85
+
86
+ ### Async Example
87
+
88
+ ```python
89
+ import asyncio
90
+
91
+ async def main():
92
+ response = await chat.agenerate("Explain async in Python briefly.")
93
+ print(response)
94
+
95
+ asyncio.run(main())
96
+ ```
97
+
98
+ ---
99
+
100
+ ## Atom-of-Thought Pipeline (AoT)
101
+
102
+ `AoTPipeline` provides structured reasoning by:
103
+
104
+ - Detecting question domains (general, math, coding, philosophy, multihop).
105
+ - Decomposing questions recursively.
106
+ - Generating direct, decomposition-based, and simplified answers.
107
+ - Combining answers via ensemble.
108
+
109
+ ### AoT Usage Example
110
+
111
+ ```python
112
+ from chatterer import Chatterer
113
+ from chatterer.strategies import AoTStrategy, AoTPipeline
114
+
115
+ pipeline = AoTPipeline(chatterer=Chatterer.openai(), max_depth=2)
116
+ strategy = AoTStrategy(pipeline=pipeline)
117
+
118
+ question = "What would Newton discover if hit by an apple falling from 100 meters?"
119
+ answer = strategy.invoke(question)
120
+ print(answer)
121
+ ```
122
+
123
+ ---
124
+
125
+ ## Supported Models
126
+
127
+ - **OpenAI**
128
+ - **Anthropic**
129
+ - **Google Gemini**
130
+ - **Ollama** (local models)
131
+
132
+ Initialize models easily:
133
+
134
+ ```python
135
+ openai_chat = Chatterer.openai("gpt-4o-mini")
136
+ anthropic_chat = Chatterer.anthropic("claude-3-7-sonnet-20250219")
137
+ gemini_chat = Chatterer.google("gemini-2.0-flash")
138
+ ollama_chat = Chatterer.ollama("deepseek-r1:1.5b")
139
+ ```
140
+
141
+ ---
142
+
143
+ ## Advanced Features
144
+
145
+ - **Streaming responses**
146
+ - **Async/Await support**
147
+ - **Structured outputs with Pydantic models**
148
+
149
+ ---
150
+
151
+ ## Logging
152
+
153
+ Built-in logging for easy debugging:
154
+
155
+ ```python
156
+ import logging
157
+ logging.basicConfig(level=logging.DEBUG)
158
+ ```
159
+
160
+ ---
161
+
162
+ ## Contributing
163
+
164
+ Feel free to open an issue or pull request.
165
+
166
+ ---
167
+
168
+ ## License
169
+
170
+ MIT License
171
+
@@ -0,0 +1,31 @@
1
+ chatterer/__init__.py,sha256=444C_hySiaJNBsG40l6d_xYY_KT5rBiQLR1mgzOc19A,1460
2
+ chatterer/language_model.py,sha256=gjZC8SyTNZ0rQke_SongcfQid26coLtE7lguhdoFuX8,24078
3
+ chatterer/messages.py,sha256=OtbZ3two0LUQ4PXES97FDIBUSO3IcMHdFV1VFkDL2mI,229
4
+ chatterer/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
+ chatterer/common_types/__init__.py,sha256=jfS6m5UANSvGjzQ_nzYDpryn5uZqNb06-4xCsQ2C_lw,376
6
+ chatterer/common_types/io.py,sha256=fetiyi1suZ3NF2mj5k5KDLJLGKS1n4J-5UmH7JN36g8,817
7
+ chatterer/strategies/__init__.py,sha256=SdOggbmHpw4f7Njwy-T8q64e91OLOUp1k0a0ozZd4qI,221
8
+ chatterer/strategies/atom_of_thoughts.py,sha256=CygOCLu5vLk-fzY9O-iE3qLShfjD7iY40ks9jH4ULBM,40872
9
+ chatterer/strategies/base.py,sha256=b2gMPqodp97OP1dkHfj0UqixjdjVhmTw_V5qJ7i2S6g,427
10
+ chatterer/tools/__init__.py,sha256=CK6hHDmgqHg70k6hHcMdHv5qutKBfReaNy2c4EaKOns,864
11
+ chatterer/tools/convert_to_text.py,sha256=gfeMDogvDg8G4ZcRC3m4yU24_0-r_cl5gXHwg2Ym9p4,14222
12
+ chatterer/tools/upstage_document_parser.py,sha256=s0mtukC93y7zwS94gjyvgcvCsr2fAUzt1LZPWYxdF1Q,17165
13
+ chatterer/tools/youtube.py,sha256=GhyE05JBF_eos01A_N-X5tZv4wQJ--IjErBbEBeNBpQ,6037
14
+ chatterer/tools/citation_chunking/__init__.py,sha256=gG7Fnkkp28UpcWMbfMY_4gqzZSZ8QzlhalHBoeoq7K0,82
15
+ chatterer/tools/citation_chunking/chunks.py,sha256=50Dpa43RaYftlNox8tM1qI8htZ3_AJ9Uyyn02WsmxYk,2173
16
+ chatterer/tools/citation_chunking/citation_chunker.py,sha256=yx5O9pUkowlNcFyyNf7f3sbq7-CV8AXOzFnviDldPR8,4894
17
+ chatterer/tools/citation_chunking/citations.py,sha256=RWVJA38yvlER9PhLDPZnqaRsbQ334W4FDQXBqGpdi08,12593
18
+ chatterer/tools/citation_chunking/prompt.py,sha256=S0Z6v8R23_Vknt3qYyjoDE1_gBsb0fCEx7LIw7BFXmA,7714
19
+ chatterer/tools/citation_chunking/reference.py,sha256=uRKufkU41Zedz6MQUCy-aCk4Rwxg94m4b332zKDpXAs,919
20
+ chatterer/tools/citation_chunking/utils.py,sha256=M4pH2-UIE1VLzQLXDqjEe4L3Xcy0e0KhAP3I2U2BNms,6348
21
+ chatterer/tools/webpage_to_markdown/__init__.py,sha256=bHH4qfnXyw8Zz-yBPLaTezF1sh9njvNBJmhBVtcpjsA,123
22
+ chatterer/tools/webpage_to_markdown/playwright_bot.py,sha256=yP0KixYZNQ4Kn_ZCFDI3mVyBD_DpUGfqgklpaGJUTCU,27496
23
+ chatterer/tools/webpage_to_markdown/utils.py,sha256=TK88-ReOUTs8njIGDY-nCNNVCPwHCVb6nV5wNuDxx2Q,12938
24
+ chatterer/utils/__init__.py,sha256=8nzpFJKU_wSRPH6LBP6HRBotPMrSl_VO9UlmFprTrK0,334
25
+ chatterer/utils/bytesio.py,sha256=3MC2atOOFKo5YxuReo_y_t8Wem9p2Y1ahC5M2lGclwI,2618
26
+ chatterer/utils/code_agent.py,sha256=UaWdeGzJMPzRSFy9yrxuveBJsvOPSa0te6OuE18bees,5143
27
+ chatterer/utils/image.py,sha256=mBqVBAhIpe1PovxKMPJ77GHcUsePQlgIWW2FZgh-6Z4,10952
28
+ chatterer-0.1.13.dist-info/METADATA,sha256=AAhg295_57oJYop5P0cBHQiiP1ArzP_Zo-8Lq7APzYY,4511
29
+ chatterer-0.1.13.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
30
+ chatterer-0.1.13.dist-info/top_level.txt,sha256=7nSQKP0bHxPRc7HyzdbKsJdkvPgYD0214o6slRizv9s,10
31
+ chatterer-0.1.13.dist-info/RECORD,,
@@ -1,27 +0,0 @@
1
- chatterer/__init__.py,sha256=dgmZGLN_oJDi6zgxxtNMJz5KKA_bSZ11l8cP9f54XhA,1328
2
- chatterer/language_model.py,sha256=mT_PNvXOKSvf9SezJO3EQKYJnfP2XwRObIdFSn99L2Q,23501
3
- chatterer/messages.py,sha256=rk2rto4eDdkKoXe9w8C0TbYoNb4FuEVwGc_uiLPDLOQ,220
4
- chatterer/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
- chatterer/strategies/__init__.py,sha256=oroDpp5ppWralCER5wnf8fgX77dqLAPF0ogmRtRzQfU,208
6
- chatterer/strategies/atom_of_thoughts.py,sha256=g801rY7k5UeNOq2-XRqB4h8sXjikVNzN57G6OtiUH00,39897
7
- chatterer/strategies/base.py,sha256=rqOzTo6S2eQ3A_F9aBXCmVoLM1eT6F2VzZ2Dof330Tk,413
8
- chatterer/tools/__init__.py,sha256=JgASkLhhy0H2coF5toZGDphI5vGtxfSIrLHYGSK2Hdk,677
9
- chatterer/tools/convert_to_text.py,sha256=isRJ667sEXtZWqpgRx2koIaC3dIP6Pe1_PJXuR10TtQ,15452
10
- chatterer/tools/youtube.py,sha256=P6I4deJt4xRuQ2ASLGELfkedD1c-foxjIM0n8RI9YTk,5891
11
- chatterer/tools/citation_chunking/__init__.py,sha256=DyLMGG4dVgSnGIdaSHcBNDz09iXflcKuJCtg4W0JTVo,79
12
- chatterer/tools/citation_chunking/chunks.py,sha256=_Sxzfbud8XTOHdHdQmKwm4-byES1cD1V6C28DgtS1BA,2120
13
- chatterer/tools/citation_chunking/citation_chunker.py,sha256=Aye1BqUCa4u_CsTZoqCe72pJA8C_y2U5UR7cNoNpeo4,4776
14
- chatterer/tools/citation_chunking/citations.py,sha256=BWhSwzZccvu0Db-OxEbsuEGEz-Dh_tXo8HRx1y2XUHg,12308
15
- chatterer/tools/citation_chunking/prompt.py,sha256=so-8uFQ5b2Zq2V5Brfxd76bEnKYkHovYsohAnbxWEnY,7557
16
- chatterer/tools/citation_chunking/reference.py,sha256=m47XYaB5uFff_x_k7US9hNr-SpZjKnl-GuzsGaQzcZo,893
17
- chatterer/tools/citation_chunking/utils.py,sha256=Xytm9lMrS783Po1qWAdEJ8q7Q3l2UMzwHd9EkYTRiwk,6210
18
- chatterer/tools/webpage_to_markdown/__init__.py,sha256=aL4O78CX6AVBXVfUoM8gLxfYb-kpmhwzwDxKk1Gj_Co,119
19
- chatterer/tools/webpage_to_markdown/playwright_bot.py,sha256=U5xvGFzn4IWCAI98hpbCD5imKRrhYBa9_RzuFNiSwYA,26847
20
- chatterer/tools/webpage_to_markdown/utils.py,sha256=N-eZrLQMEmrBwlBBNB1t7c6eEWLGi2kdqoYyrqYq-ec,12604
21
- chatterer/utils/__init__.py,sha256=qf1gGonmQP3EAaMJtZf_BCYtxgrKH8ymdvD9sF_ezes,319
22
- chatterer/utils/code_agent.py,sha256=jfv7a67hwHpdbGg8MmjHrZ3buRE2r32XVlXaWtqtuKY,5005
23
- chatterer/utils/image.py,sha256=nRnHXYtU9LVm6lChvvFl67GytkmD4t6xahbCJprThvQ,10661
24
- chatterer-0.1.12.dist-info/METADATA,sha256=61l16uSGfXUfUCcXfGnYvYSlVcvrPkRyedhAoiavyVo,4288
25
- chatterer-0.1.12.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
26
- chatterer-0.1.12.dist-info/top_level.txt,sha256=7nSQKP0bHxPRc7HyzdbKsJdkvPgYD0214o6slRizv9s,10
27
- chatterer-0.1.12.dist-info/RECORD,,