chatterer 0.1.2__py3-none-any.whl → 0.1.3__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.
- chatterer/__init__.py +21 -23
- chatterer/language_model.py +590 -0
- chatterer/strategies/__init__.py +19 -0
- chatterer/strategies/atom_of_thoughts.py +594 -0
- chatterer/strategies/base.py +14 -0
- chatterer-0.1.3.dist-info/METADATA +150 -0
- chatterer-0.1.3.dist-info/RECORD +9 -0
- chatterer/llms/__init__.py +0 -20
- chatterer/llms/base.py +0 -42
- chatterer/llms/instructor.py +0 -127
- chatterer/llms/langchain.py +0 -49
- chatterer/llms/ollama.py +0 -69
- chatterer-0.1.2.dist-info/METADATA +0 -213
- chatterer-0.1.2.dist-info/RECORD +0 -10
- {chatterer-0.1.2.dist-info → chatterer-0.1.3.dist-info}/WHEEL +0 -0
- {chatterer-0.1.2.dist-info → chatterer-0.1.3.dist-info}/top_level.txt +0 -0
chatterer/__init__.py
CHANGED
@@ -1,24 +1,22 @@
|
|
1
|
-
from .
|
1
|
+
from .language_model import Chatterer, InvokeKwargs
|
2
|
+
from .strategies import (
|
3
|
+
AoTPipeline,
|
4
|
+
AoTStrategy,
|
5
|
+
BaseAoTPrompter,
|
6
|
+
BaseStrategy,
|
7
|
+
CodingAoTPrompter,
|
8
|
+
GeneralAoTPrompter,
|
9
|
+
PhilosophyAoTPrompter,
|
10
|
+
)
|
2
11
|
|
3
|
-
__all__ = [
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
__all__ += ["OllamaLLM"]
|
16
|
-
except ImportError:
|
17
|
-
pass
|
18
|
-
|
19
|
-
try:
|
20
|
-
from .llms import InstructorLLM
|
21
|
-
|
22
|
-
__all__ += ["InstructorLLM"]
|
23
|
-
except ImportError:
|
24
|
-
pass
|
12
|
+
__all__ = [
|
13
|
+
"BaseStrategy",
|
14
|
+
"Chatterer",
|
15
|
+
"InvokeKwargs",
|
16
|
+
"AoTStrategy",
|
17
|
+
"AoTPipeline",
|
18
|
+
"BaseAoTPrompter",
|
19
|
+
"GeneralAoTPrompter",
|
20
|
+
"CodingAoTPrompter",
|
21
|
+
"PhilosophyAoTPrompter",
|
22
|
+
]
|
@@ -0,0 +1,590 @@
|
|
1
|
+
from typing import (
|
2
|
+
Any,
|
3
|
+
AsyncIterator,
|
4
|
+
Iterator,
|
5
|
+
NotRequired,
|
6
|
+
Optional,
|
7
|
+
Self,
|
8
|
+
Type,
|
9
|
+
TypeAlias,
|
10
|
+
TypedDict,
|
11
|
+
TypeVar,
|
12
|
+
)
|
13
|
+
|
14
|
+
from langchain_core.language_models.base import LanguageModelInput
|
15
|
+
from langchain_core.language_models.chat_models import BaseChatModel
|
16
|
+
from langchain_core.runnables.config import RunnableConfig
|
17
|
+
from pydantic import BaseModel
|
18
|
+
|
19
|
+
PydanticModelT = TypeVar("PydanticModelT", bound=BaseModel)
|
20
|
+
ContentType: TypeAlias = str | list[str | dict[str, Any]]
|
21
|
+
StructuredOutputType: TypeAlias = dict[str, Any] | BaseModel
|
22
|
+
|
23
|
+
|
24
|
+
class InvokeKwargs(TypedDict):
|
25
|
+
config: NotRequired[RunnableConfig]
|
26
|
+
stop: NotRequired[list[str]]
|
27
|
+
kwargs: NotRequired[dict[str, Any]]
|
28
|
+
|
29
|
+
|
30
|
+
class Chatterer(BaseModel):
|
31
|
+
"""Language model for generating text from a given input."""
|
32
|
+
|
33
|
+
client: BaseChatModel
|
34
|
+
|
35
|
+
def __call__(self, messages: LanguageModelInput) -> str:
|
36
|
+
return self.generate(messages)
|
37
|
+
|
38
|
+
@classmethod
|
39
|
+
def openai(cls, name: str = "gpt-4o-mini") -> Self:
|
40
|
+
from langchain_openai import ChatOpenAI
|
41
|
+
|
42
|
+
return cls(client=ChatOpenAI(name=name))
|
43
|
+
|
44
|
+
@classmethod
|
45
|
+
def anthropic(cls, model_name: str = "claude-3-7-sonnet-20250219") -> Self:
|
46
|
+
from langchain_anthropic import ChatAnthropic
|
47
|
+
|
48
|
+
return cls(client=ChatAnthropic(model_name=model_name, timeout=None, stop=None))
|
49
|
+
|
50
|
+
@classmethod
|
51
|
+
def google(cls, model: str = "gemini-2.0-flash") -> Self:
|
52
|
+
from langchain_google_genai import ChatGoogleGenerativeAI
|
53
|
+
|
54
|
+
return cls(client=ChatGoogleGenerativeAI(model=model))
|
55
|
+
|
56
|
+
@classmethod
|
57
|
+
def ollama(cls, model: str = "deepseek-r1:1.5b") -> Self:
|
58
|
+
from langchain_ollama import ChatOllama
|
59
|
+
|
60
|
+
return cls(client=ChatOllama(model=model))
|
61
|
+
|
62
|
+
def generate(
|
63
|
+
self,
|
64
|
+
messages: LanguageModelInput,
|
65
|
+
config: Optional[RunnableConfig] = None,
|
66
|
+
stop: Optional[list[str]] = None,
|
67
|
+
**kwargs: Any,
|
68
|
+
) -> str:
|
69
|
+
content: ContentType = self.client.invoke(input=messages, config=config, stop=stop, **kwargs).content
|
70
|
+
if isinstance(content, str):
|
71
|
+
return content
|
72
|
+
else:
|
73
|
+
return "".join(part for part in content if isinstance(part, str))
|
74
|
+
|
75
|
+
async def agenerate(
|
76
|
+
self,
|
77
|
+
messages: LanguageModelInput,
|
78
|
+
config: Optional[RunnableConfig] = None,
|
79
|
+
stop: Optional[list[str]] = None,
|
80
|
+
**kwargs: Any,
|
81
|
+
) -> str:
|
82
|
+
content: ContentType = (await self.client.ainvoke(input=messages, config=config, stop=stop, **kwargs)).content
|
83
|
+
if isinstance(content, str):
|
84
|
+
return content
|
85
|
+
else:
|
86
|
+
return "".join(part for part in content if isinstance(part, str))
|
87
|
+
|
88
|
+
def generate_stream(
|
89
|
+
self,
|
90
|
+
messages: LanguageModelInput,
|
91
|
+
config: Optional[RunnableConfig] = None,
|
92
|
+
stop: Optional[list[str]] = None,
|
93
|
+
**kwargs: Any,
|
94
|
+
) -> Iterator[str]:
|
95
|
+
for chunk in self.client.stream(input=messages, config=config, stop=stop, **kwargs):
|
96
|
+
content: ContentType = chunk.content
|
97
|
+
if isinstance(content, str):
|
98
|
+
yield content
|
99
|
+
elif isinstance(content, list):
|
100
|
+
for part in content:
|
101
|
+
if isinstance(part, str):
|
102
|
+
yield part
|
103
|
+
else:
|
104
|
+
continue
|
105
|
+
else:
|
106
|
+
continue
|
107
|
+
|
108
|
+
async def agenerate_stream(
|
109
|
+
self,
|
110
|
+
messages: LanguageModelInput,
|
111
|
+
config: Optional[RunnableConfig] = None,
|
112
|
+
stop: Optional[list[str]] = None,
|
113
|
+
**kwargs: Any,
|
114
|
+
) -> AsyncIterator[str]:
|
115
|
+
async for chunk in self.client.astream(input=messages, config=config, stop=stop, **kwargs):
|
116
|
+
content: ContentType = chunk.content
|
117
|
+
if isinstance(content, str):
|
118
|
+
yield content
|
119
|
+
elif isinstance(content, list):
|
120
|
+
for part in content:
|
121
|
+
if isinstance(part, str):
|
122
|
+
yield part
|
123
|
+
else:
|
124
|
+
continue
|
125
|
+
else:
|
126
|
+
continue
|
127
|
+
|
128
|
+
def generate_pydantic(
|
129
|
+
self,
|
130
|
+
response_model: Type[PydanticModelT],
|
131
|
+
messages: LanguageModelInput,
|
132
|
+
config: Optional[RunnableConfig] = None,
|
133
|
+
stop: Optional[list[str]] = None,
|
134
|
+
**kwargs: Any,
|
135
|
+
) -> PydanticModelT:
|
136
|
+
result: StructuredOutputType = self.client.with_structured_output(response_model).invoke(
|
137
|
+
input=messages, config=config, stop=stop, **kwargs
|
138
|
+
)
|
139
|
+
if isinstance(result, response_model):
|
140
|
+
return result
|
141
|
+
else:
|
142
|
+
return response_model.model_validate(result)
|
143
|
+
|
144
|
+
async def agenerate_pydantic(
|
145
|
+
self,
|
146
|
+
response_model: Type[PydanticModelT],
|
147
|
+
messages: LanguageModelInput,
|
148
|
+
config: Optional[RunnableConfig] = None,
|
149
|
+
stop: Optional[list[str]] = None,
|
150
|
+
**kwargs: Any,
|
151
|
+
) -> PydanticModelT:
|
152
|
+
result: StructuredOutputType = await self.client.with_structured_output(response_model).ainvoke(
|
153
|
+
input=messages, config=config, stop=stop, **kwargs
|
154
|
+
)
|
155
|
+
if isinstance(result, response_model):
|
156
|
+
return result
|
157
|
+
else:
|
158
|
+
return response_model.model_validate(result)
|
159
|
+
|
160
|
+
def generate_pydantic_stream(
|
161
|
+
self,
|
162
|
+
response_model: Type[PydanticModelT],
|
163
|
+
messages: LanguageModelInput,
|
164
|
+
config: Optional[RunnableConfig] = None,
|
165
|
+
stop: Optional[list[str]] = None,
|
166
|
+
**kwargs: Any,
|
167
|
+
) -> Iterator[PydanticModelT]:
|
168
|
+
try:
|
169
|
+
import instructor
|
170
|
+
except ImportError:
|
171
|
+
raise ImportError("Please install `instructor` with `pip install instructor` to use this feature.")
|
172
|
+
|
173
|
+
partial_response_model = instructor.Partial[response_model]
|
174
|
+
for chunk in self.client.with_structured_output(partial_response_model).stream(
|
175
|
+
input=messages, config=config, stop=stop, **kwargs
|
176
|
+
):
|
177
|
+
yield response_model.model_validate(chunk)
|
178
|
+
|
179
|
+
async def agenerate_pydantic_stream(
|
180
|
+
self,
|
181
|
+
response_model: Type[PydanticModelT],
|
182
|
+
messages: LanguageModelInput,
|
183
|
+
config: Optional[RunnableConfig] = None,
|
184
|
+
stop: Optional[list[str]] = None,
|
185
|
+
**kwargs: Any,
|
186
|
+
) -> AsyncIterator[PydanticModelT]:
|
187
|
+
try:
|
188
|
+
import instructor
|
189
|
+
except ImportError:
|
190
|
+
raise ImportError("Please install `instructor` with `pip install instructor` to use this feature.")
|
191
|
+
|
192
|
+
partial_response_model = instructor.Partial[response_model]
|
193
|
+
async for chunk in self.client.with_structured_output(partial_response_model).astream(
|
194
|
+
input=messages, config=config, stop=stop, **kwargs
|
195
|
+
):
|
196
|
+
yield response_model.model_validate(chunk)
|
197
|
+
|
198
|
+
|
199
|
+
if __name__ == "__main__":
|
200
|
+
import asyncio
|
201
|
+
|
202
|
+
# 테스트용 Pydantic 모델 정의
|
203
|
+
class Propositions(BaseModel):
|
204
|
+
proposition_topic: str
|
205
|
+
proposition_content: str
|
206
|
+
|
207
|
+
chatterer = Chatterer.openai()
|
208
|
+
prompt = "What is the meaning of life?"
|
209
|
+
|
210
|
+
# === Synchronous Tests ===
|
211
|
+
|
212
|
+
# 1. generate
|
213
|
+
print("=== Synchronous generate ===")
|
214
|
+
result_sync = chatterer.generate(prompt)
|
215
|
+
print("Result (generate):", result_sync)
|
216
|
+
|
217
|
+
# 2. __call__
|
218
|
+
print("\n=== Synchronous __call__ ===")
|
219
|
+
result_call = chatterer(prompt)
|
220
|
+
print("Result (__call__):", result_call)
|
221
|
+
|
222
|
+
# 3. generate_stream
|
223
|
+
print("\n=== Synchronous generate_stream ===")
|
224
|
+
for i, chunk in enumerate(chatterer.generate_stream(prompt)):
|
225
|
+
print(f"Chunk {i}:", chunk)
|
226
|
+
|
227
|
+
# 4. generate_pydantic
|
228
|
+
print("\n=== Synchronous generate_pydantic ===")
|
229
|
+
try:
|
230
|
+
result_pydantic = chatterer.generate_pydantic(Propositions, prompt)
|
231
|
+
print("Result (generate_pydantic):", result_pydantic)
|
232
|
+
except Exception as e:
|
233
|
+
print("Error in generate_pydantic:", e)
|
234
|
+
|
235
|
+
# 5. generate_pydantic_stream
|
236
|
+
print("\n=== Synchronous generate_pydantic_stream ===")
|
237
|
+
try:
|
238
|
+
for i, chunk in enumerate(chatterer.generate_pydantic_stream(Propositions, prompt)):
|
239
|
+
print(f"Pydantic Chunk {i}:", chunk)
|
240
|
+
except Exception as e:
|
241
|
+
print("Error in generate_pydantic_stream:", e)
|
242
|
+
|
243
|
+
# === Asynchronous Tests ===
|
244
|
+
|
245
|
+
# Async helper function to enumerate async iterator
|
246
|
+
async def async_enumerate(aiter: AsyncIterator[Any], start: int = 0) -> AsyncIterator[tuple[int, Any]]:
|
247
|
+
i = start
|
248
|
+
async for item in aiter:
|
249
|
+
yield i, item
|
250
|
+
i += 1
|
251
|
+
|
252
|
+
async def run_async_tests():
|
253
|
+
# 6. agenerate
|
254
|
+
print("\n=== Asynchronous agenerate ===")
|
255
|
+
result_async = await chatterer.agenerate(prompt)
|
256
|
+
print("Result (agenerate):", result_async)
|
257
|
+
|
258
|
+
# 7. agenerate_stream
|
259
|
+
print("\n=== Asynchronous agenerate_stream ===")
|
260
|
+
async for i, chunk in async_enumerate(chatterer.agenerate_stream(prompt)):
|
261
|
+
print(f"Async Chunk {i}:", chunk)
|
262
|
+
|
263
|
+
# 8. agenerate_pydantic
|
264
|
+
print("\n=== Asynchronous agenerate_pydantic ===")
|
265
|
+
try:
|
266
|
+
result_async_pydantic = await chatterer.agenerate_pydantic(Propositions, prompt)
|
267
|
+
print("Result (agenerate_pydantic):", result_async_pydantic)
|
268
|
+
except Exception as e:
|
269
|
+
print("Error in agenerate_pydantic:", e)
|
270
|
+
|
271
|
+
# 9. agenerate_pydantic_stream
|
272
|
+
print("\n=== Asynchronous agenerate_pydantic_stream ===")
|
273
|
+
try:
|
274
|
+
i = 0
|
275
|
+
async for chunk in chatterer.agenerate_pydantic_stream(Propositions, prompt):
|
276
|
+
print(f"Async Pydantic Chunk {i}:", chunk)
|
277
|
+
i += 1
|
278
|
+
except Exception as e:
|
279
|
+
print("Error in agenerate_pydantic_stream:", e)
|
280
|
+
|
281
|
+
asyncio.run(run_async_tests())
|
282
|
+
|
283
|
+
# === Synchronous generate ===
|
284
|
+
# Result (generate): The meaning of life is a deeply philosophical question that has been pondered by humans for centuries. Different cultures, religions, and belief systems have their own interpretations of the meaning of life. Some believe that the meaning of life is to seek happiness and pleasure, others believe it is to serve a higher power or fulfill a spiritual purpose. Ultimately, the meaning of life is a personal and subjective concept that each individual must find and define for themselves.
|
285
|
+
|
286
|
+
# === Synchronous __call__ ===
|
287
|
+
# Result (__call__): The meaning of life is a philosophical and existential question that has been debated for centuries. Different individuals, cultures, and philosophies offer varying perspectives on the purpose and significance of life. Some believe that the meaning of life is to seek happiness, fulfillment, and personal growth, while others believe it is to fulfill a higher spiritual or moral purpose. Ultimately, the meaning of life is a deeply personal and subjective concept that each individual must explore and discover for themselves.
|
288
|
+
|
289
|
+
# === Synchronous generate_stream ===
|
290
|
+
# Chunk 0:
|
291
|
+
# Chunk 1: The
|
292
|
+
# Chunk 2: meaning
|
293
|
+
# Chunk 3: of
|
294
|
+
# Chunk 4: life
|
295
|
+
# Chunk 5: is
|
296
|
+
# Chunk 6: a
|
297
|
+
# Chunk 7: complex
|
298
|
+
# Chunk 8: and
|
299
|
+
# Chunk 9: deeply
|
300
|
+
# Chunk 10: personal
|
301
|
+
# Chunk 11: question
|
302
|
+
# Chunk 12: that
|
303
|
+
# Chunk 13: has
|
304
|
+
# Chunk 14: been
|
305
|
+
# Chunk 15: debated
|
306
|
+
# Chunk 16: by
|
307
|
+
# Chunk 17: philosophers
|
308
|
+
# Chunk 18: ,
|
309
|
+
# Chunk 19: theolog
|
310
|
+
# Chunk 20: ians
|
311
|
+
# Chunk 21: ,
|
312
|
+
# Chunk 22: and
|
313
|
+
# Chunk 23: individuals
|
314
|
+
# Chunk 24: throughout
|
315
|
+
# Chunk 25: history
|
316
|
+
# Chunk 26: .
|
317
|
+
# Chunk 27: The
|
318
|
+
# Chunk 28: answer
|
319
|
+
# Chunk 29: to
|
320
|
+
# Chunk 30: this
|
321
|
+
# Chunk 31: question
|
322
|
+
# Chunk 32: can
|
323
|
+
# Chunk 33: vary
|
324
|
+
# Chunk 34: greatly
|
325
|
+
# Chunk 35: depending
|
326
|
+
# Chunk 36: on
|
327
|
+
# Chunk 37: one
|
328
|
+
# Chunk 38: 's
|
329
|
+
# Chunk 39: beliefs
|
330
|
+
# Chunk 40: ,
|
331
|
+
# Chunk 41: values
|
332
|
+
# Chunk 42: ,
|
333
|
+
# Chunk 43: and
|
334
|
+
# Chunk 44: experiences
|
335
|
+
# Chunk 45: .
|
336
|
+
# Chunk 46: Some
|
337
|
+
# Chunk 47: may
|
338
|
+
# Chunk 48: find
|
339
|
+
# Chunk 49: meaning
|
340
|
+
# Chunk 50: in
|
341
|
+
# Chunk 51: pursuing
|
342
|
+
# Chunk 52: personal
|
343
|
+
# Chunk 53: happiness
|
344
|
+
# Chunk 54: and
|
345
|
+
# Chunk 55: fulfillment
|
346
|
+
# Chunk 56: ,
|
347
|
+
# Chunk 57: others
|
348
|
+
# Chunk 58: may
|
349
|
+
# Chunk 59: find
|
350
|
+
# Chunk 60: meaning
|
351
|
+
# Chunk 61: in
|
352
|
+
# Chunk 62: contributing
|
353
|
+
# Chunk 63: to
|
354
|
+
# Chunk 64: the
|
355
|
+
# Chunk 65: greater
|
356
|
+
# Chunk 66: good
|
357
|
+
# Chunk 67: of
|
358
|
+
# Chunk 68: society
|
359
|
+
# Chunk 69: ,
|
360
|
+
# Chunk 70: while
|
361
|
+
# Chunk 71: others
|
362
|
+
# Chunk 72: may
|
363
|
+
# Chunk 73: find
|
364
|
+
# Chunk 74: meaning
|
365
|
+
# Chunk 75: in
|
366
|
+
# Chunk 76: spiritual
|
367
|
+
# Chunk 77: or
|
368
|
+
# Chunk 78: religious
|
369
|
+
# Chunk 79: beliefs
|
370
|
+
# Chunk 80: .
|
371
|
+
# Chunk 81: Ultimately
|
372
|
+
# Chunk 82: ,
|
373
|
+
# Chunk 83: the
|
374
|
+
# Chunk 84: meaning
|
375
|
+
# Chunk 85: of
|
376
|
+
# Chunk 86: life
|
377
|
+
# Chunk 87: is
|
378
|
+
# Chunk 88: subjective
|
379
|
+
# Chunk 89: and
|
380
|
+
# Chunk 90: can
|
381
|
+
# Chunk 91: differ
|
382
|
+
# Chunk 92: from
|
383
|
+
# Chunk 93: person
|
384
|
+
# Chunk 94: to
|
385
|
+
# Chunk 95: person
|
386
|
+
# Chunk 96: .
|
387
|
+
# Chunk 97:
|
388
|
+
|
389
|
+
# === Synchronous generate_pydantic ===
|
390
|
+
# C:\Users\cosogi\chatterer\.venv\Lib\site-packages\langchain_openai\chat_models\base.py:1390: UserWarning: Cannot use method='json_schema' with model gpt-3.5-turbo since it doesn't support OpenAI's Structured Output API. You can see supported models here: https://platform.openai.com/docs/guides/structured-outputs#supported-models. To fix this warning, set `method='function_calling'. Overriding to method='function_calling'.
|
391
|
+
# warnings.warn(
|
392
|
+
# Result (generate_pydantic): proposition_topic='meaning of life' proposition_content='The meaning of life is a philosophical question that has been debated by thinkers and scholars for centuries. There are different perspectives on the meaning of life, including religious, existential, and philosophical views. Some argue that the meaning of life is to seek happiness and fulfillment, while others believe it is to fulfill a higher purpose or serve others. Ultimately, the meaning of life is subjective and may vary depending on individual beliefs and values.'
|
393
|
+
|
394
|
+
# === Synchronous generate_pydantic_stream ===
|
395
|
+
# C:\Users\cosogi\chatterer\.venv\Lib\site-packages\langchain_openai\chat_models\base.py:1390: UserWarning: Cannot use method='json_schema' with model gpt-3.5-turbo since it doesn't support OpenAI's Structured Output API. You can see supported models here: https://platform.openai.com/docs/guides/structured-outputs#supported-models. To fix this warning, set `method='function_calling'. Overriding to method='function_calling'.
|
396
|
+
# warnings.warn(
|
397
|
+
# Pydantic Chunk 0: proposition_topic='Meaning of Life' proposition_content=''
|
398
|
+
# Pydantic Chunk 1: proposition_topic='Meaning of Life' proposition_content='The'
|
399
|
+
# Pydantic Chunk 2: proposition_topic='Meaning of Life' proposition_content='The meaning'
|
400
|
+
# Pydantic Chunk 3: proposition_topic='Meaning of Life' proposition_content='The meaning of'
|
401
|
+
# Pydantic Chunk 4: proposition_topic='Meaning of Life' proposition_content='The meaning of life'
|
402
|
+
# Pydantic Chunk 5: proposition_topic='Meaning of Life' proposition_content='The meaning of life is'
|
403
|
+
# Pydantic Chunk 6: proposition_topic='Meaning of Life' proposition_content='The meaning of life is a'
|
404
|
+
# Pydantic Chunk 7: proposition_topic='Meaning of Life' proposition_content='The meaning of life is a philosophical'
|
405
|
+
# Pydantic Chunk 8: proposition_topic='Meaning of Life' proposition_content='The meaning of life is a philosophical and'
|
406
|
+
# Pydantic Chunk 9: proposition_topic='Meaning of Life' proposition_content='The meaning of life is a philosophical and existential'
|
407
|
+
# Pydantic Chunk 10: proposition_topic='Meaning of Life' proposition_content='The meaning of life is a philosophical and existential question'
|
408
|
+
# Pydantic Chunk 11: proposition_topic='Meaning of Life' proposition_content='The meaning of life is a philosophical and existential question that'
|
409
|
+
# Pydantic Chunk 12: proposition_topic='Meaning of Life' proposition_content='The meaning of life is a philosophical and existential question that has'
|
410
|
+
# Pydantic Chunk 13: proposition_topic='Meaning of Life' proposition_content='The meaning of life is a philosophical and existential question that has been'
|
411
|
+
# Pydantic Chunk 14: proposition_topic='Meaning of Life' proposition_content='The meaning of life is a philosophical and existential question that has been debated'
|
412
|
+
# Pydantic Chunk 15: proposition_topic='Meaning of Life' proposition_content='The meaning of life is a philosophical and existential question that has been debated by'
|
413
|
+
# Pydantic Chunk 16: proposition_topic='Meaning of Life' proposition_content='The meaning of life is a philosophical and existential question that has been debated by scholars'
|
414
|
+
# Pydantic Chunk 17: proposition_topic='Meaning of Life' proposition_content='The meaning of life is a philosophical and existential question that has been debated by scholars,'
|
415
|
+
# Pydantic Chunk 18: proposition_topic='Meaning of Life' proposition_content='The meaning of life is a philosophical and existential question that has been debated by scholars, philosophers'
|
416
|
+
# Pydantic Chunk 19: proposition_topic='Meaning of Life' proposition_content='The meaning of life is a philosophical and existential question that has been debated by scholars, philosophers,'
|
417
|
+
# Pydantic Chunk 20: proposition_topic='Meaning of Life' proposition_content='The meaning of life is a philosophical and existential question that has been debated by scholars, philosophers, and'
|
418
|
+
# Pydantic Chunk 21: proposition_topic='Meaning of Life' proposition_content='The meaning of life is a philosophical and existential question that has been debated by scholars, philosophers, and individuals'
|
419
|
+
# Pydantic Chunk 22: proposition_topic='Meaning of Life' proposition_content='The meaning of life is a philosophical and existential question that has been debated by scholars, philosophers, and individuals throughout'
|
420
|
+
# Pydantic Chunk 23: proposition_topic='Meaning of Life' proposition_content='The meaning of life is a philosophical and existential question that has been debated by scholars, philosophers, and individuals throughout history'
|
421
|
+
# Pydantic Chunk 24: proposition_topic='Meaning of Life' proposition_content='The meaning of life is a philosophical and existential question that has been debated by scholars, philosophers, and individuals throughout history.'
|
422
|
+
# Pydantic Chunk 25: proposition_topic='Meaning of Life' proposition_content='The meaning of life is a philosophical and existential question that has been debated by scholars, philosophers, and individuals throughout history. It'
|
423
|
+
# Pydantic Chunk 26: proposition_topic='Meaning of Life' proposition_content='The meaning of life is a philosophical and existential question that has been debated by scholars, philosophers, and individuals throughout history. It refers'
|
424
|
+
# Pydantic Chunk 27: proposition_topic='Meaning of Life' proposition_content='The meaning of life is a philosophical and existential question that has been debated by scholars, philosophers, and individuals throughout history. It refers to'
|
425
|
+
# Pydantic Chunk 28: proposition_topic='Meaning of Life' proposition_content='The meaning of life is a philosophical and existential question that has been debated by scholars, philosophers, and individuals throughout history. It refers to the'
|
426
|
+
# Pydantic Chunk 29: proposition_topic='Meaning of Life' proposition_content='The meaning of life is a philosophical and existential question that has been debated by scholars, philosophers, and individuals throughout history. It refers to the purpose'
|
427
|
+
# Pydantic Chunk 30: proposition_topic='Meaning of Life' proposition_content='The meaning of life is a philosophical and existential question that has been debated by scholars, philosophers, and individuals throughout history. It refers to the purpose,'
|
428
|
+
# Pydantic Chunk 31: proposition_topic='Meaning of Life' proposition_content='The meaning of life is a philosophical and existential question that has been debated by scholars, philosophers, and individuals throughout history. It refers to the purpose, significance'
|
429
|
+
# Pydantic Chunk 32: proposition_topic='Meaning of Life' proposition_content='The meaning of life is a philosophical and existential question that has been debated by scholars, philosophers, and individuals throughout history. It refers to the purpose, significance,'
|
430
|
+
# Pydantic Chunk 33: proposition_topic='Meaning of Life' proposition_content='The meaning of life is a philosophical and existential question that has been debated by scholars, philosophers, and individuals throughout history. It refers to the purpose, significance, or'
|
431
|
+
# Pydantic Chunk 34: proposition_topic='Meaning of Life' proposition_content='The meaning of life is a philosophical and existential question that has been debated by scholars, philosophers, and individuals throughout history. It refers to the purpose, significance, or value'
|
432
|
+
# Pydantic Chunk 35: proposition_topic='Meaning of Life' proposition_content='The meaning of life is a philosophical and existential question that has been debated by scholars, philosophers, and individuals throughout history. It refers to the purpose, significance, or value of'
|
433
|
+
# Pydantic Chunk 36: proposition_topic='Meaning of Life' proposition_content='The meaning of life is a philosophical and existential question that has been debated by scholars, philosophers, and individuals throughout history. It refers to the purpose, significance, or value of human'
|
434
|
+
# Pydantic Chunk 37: proposition_topic='Meaning of Life' proposition_content='The meaning of life is a philosophical and existential question that has been debated by scholars, philosophers, and individuals throughout history. It refers to the purpose, significance, or value of human existence'
|
435
|
+
# Pydantic Chunk 38: proposition_topic='Meaning of Life' proposition_content='The meaning of life is a philosophical and existential question that has been debated by scholars, philosophers, and individuals throughout history. It refers to the purpose, significance, or value of human existence and'
|
436
|
+
# Pydantic Chunk 39: proposition_topic='Meaning of Life' proposition_content='The meaning of life is a philosophical and existential question that has been debated by scholars, philosophers, and individuals throughout history. It refers to the purpose, significance, or value of human existence and consciousness'
|
437
|
+
# Pydantic Chunk 40: proposition_topic='Meaning of Life' proposition_content='The meaning of life is a philosophical and existential question that has been debated by scholars, philosophers, and individuals throughout history. It refers to the purpose, significance, or value of human existence and consciousness.'
|
438
|
+
|
439
|
+
# === Asynchronous agenerate ===
|
440
|
+
# Result (agenerate): The meaning of life is a complex and subjective philosophical question that has been debated throughout history. Different individuals and cultures may have different beliefs and perspectives on the meaning of life. Some may believe that the meaning of life is to seek happiness and fulfillment, others may believe it is to serve a higher power or contribute to the greater good of society. Ultimately, the meaning of life is a highly personal and individualistic concept that each person must determine for themselves.
|
441
|
+
|
442
|
+
# === Asynchronous agenerate_stream ===
|
443
|
+
# Async Chunk 0:
|
444
|
+
# Async Chunk 1: This
|
445
|
+
# Async Chunk 2: is
|
446
|
+
# Async Chunk 3: a
|
447
|
+
# Async Chunk 4: deeply
|
448
|
+
# Async Chunk 5: philosophical
|
449
|
+
# Async Chunk 6: question
|
450
|
+
# Async Chunk 7: that
|
451
|
+
# Async Chunk 8: has
|
452
|
+
# Async Chunk 9: puzzled
|
453
|
+
# Async Chunk 10: humans
|
454
|
+
# Async Chunk 11: for
|
455
|
+
# Async Chunk 12: centuries
|
456
|
+
# Async Chunk 13: .
|
457
|
+
# Async Chunk 14: The
|
458
|
+
# Async Chunk 15: meaning
|
459
|
+
# Async Chunk 16: of
|
460
|
+
# Async Chunk 17: life
|
461
|
+
# Async Chunk 18: is
|
462
|
+
# Async Chunk 19: a
|
463
|
+
# Async Chunk 20: highly
|
464
|
+
# Async Chunk 21: individual
|
465
|
+
# Async Chunk 22: and
|
466
|
+
# Async Chunk 23: subjective
|
467
|
+
# Async Chunk 24: concept
|
468
|
+
# Async Chunk 25: ,
|
469
|
+
# Async Chunk 26: with
|
470
|
+
# Async Chunk 27: different
|
471
|
+
# Async Chunk 28: people
|
472
|
+
# Async Chunk 29: finding
|
473
|
+
# Async Chunk 30: meaning
|
474
|
+
# Async Chunk 31: in
|
475
|
+
# Async Chunk 32: different
|
476
|
+
# Async Chunk 33: things
|
477
|
+
# Async Chunk 34: .
|
478
|
+
# Async Chunk 35: Some
|
479
|
+
# Async Chunk 36: may
|
480
|
+
# Async Chunk 37: find
|
481
|
+
# Async Chunk 38: meaning
|
482
|
+
# Async Chunk 39: in
|
483
|
+
# Async Chunk 40: their
|
484
|
+
# Async Chunk 41: relationships
|
485
|
+
# Async Chunk 42: ,
|
486
|
+
# Async Chunk 43: their
|
487
|
+
# Async Chunk 44: work
|
488
|
+
# Async Chunk 45: ,
|
489
|
+
# Async Chunk 46: their
|
490
|
+
# Async Chunk 47: beliefs
|
491
|
+
# Async Chunk 48: ,
|
492
|
+
# Async Chunk 49: or
|
493
|
+
# Async Chunk 50: their
|
494
|
+
# Async Chunk 51: experiences
|
495
|
+
# Async Chunk 52: .
|
496
|
+
# Async Chunk 53: Others
|
497
|
+
# Async Chunk 54: may
|
498
|
+
# Async Chunk 55: find
|
499
|
+
# Async Chunk 56: meaning
|
500
|
+
# Async Chunk 57: in
|
501
|
+
# Async Chunk 58: the
|
502
|
+
# Async Chunk 59: pursuit
|
503
|
+
# Async Chunk 60: of
|
504
|
+
# Async Chunk 61: personal
|
505
|
+
# Async Chunk 62: growth
|
506
|
+
# Async Chunk 63: ,
|
507
|
+
# Async Chunk 64: knowledge
|
508
|
+
# Async Chunk 65: ,
|
509
|
+
# Async Chunk 66: or
|
510
|
+
# Async Chunk 67: happiness
|
511
|
+
# Async Chunk 68: .
|
512
|
+
# Async Chunk 69: Ultimately
|
513
|
+
# Async Chunk 70: ,
|
514
|
+
# Async Chunk 71: the
|
515
|
+
# Async Chunk 72: meaning
|
516
|
+
# Async Chunk 73: of
|
517
|
+
# Async Chunk 74: life
|
518
|
+
# Async Chunk 75: is
|
519
|
+
# Async Chunk 76: something
|
520
|
+
# Async Chunk 77: that
|
521
|
+
# Async Chunk 78: each
|
522
|
+
# Async Chunk 79: person
|
523
|
+
# Async Chunk 80: must
|
524
|
+
# Async Chunk 81: discover
|
525
|
+
# Async Chunk 82: for
|
526
|
+
# Async Chunk 83: themselves
|
527
|
+
# Async Chunk 84: through
|
528
|
+
# Async Chunk 85: intros
|
529
|
+
# Async Chunk 86: pection
|
530
|
+
# Async Chunk 87: ,
|
531
|
+
# Async Chunk 88: reflection
|
532
|
+
# Async Chunk 89: ,
|
533
|
+
# Async Chunk 90: and
|
534
|
+
# Async Chunk 91: experience
|
535
|
+
# Async Chunk 92: .
|
536
|
+
# Async Chunk 93:
|
537
|
+
|
538
|
+
# === Asynchronous agenerate_pydantic ===
|
539
|
+
# C:\Users\cosogi\chatterer\.venv\Lib\site-packages\langchain_openai\chat_models\base.py:1390: UserWarning: Cannot use method='json_schema' with model gpt-3.5-turbo since it doesn't support OpenAI's Structured Output API. You can see supported models here: https://platform.openai.com/docs/guides/structured-outputs#supported-models. To fix this warning, set `method='function_calling'. Overriding to method='function_calling'.
|
540
|
+
# warnings.warn(
|
541
|
+
# Result (agenerate_pydantic): proposition_topic='Meaning of Life' proposition_content='The meaning of life is a philosophical and existential question that explores the purpose and significance of human existence. It is a complex and subjective concept that has been debated by philosophers, theologians, and thinkers throughout history. Some believe that the meaning of life is to seek happiness, fulfillment, or spiritual enlightenment, while others argue that it is to make a positive impact on the world or to find meaning in personal relationships and experiences. Ultimately, the meaning of life is a deeply personal and reflective question that each individual must contemplate and define for themselves.'
|
542
|
+
|
543
|
+
# === Asynchronous agenerate_pydantic_stream ===
|
544
|
+
# C:\Users\cosogi\chatterer\.venv\Lib\site-packages\langchain_openai\chat_models\base.py:1390: UserWarning: Cannot use method='json_schema' with model gpt-3.5-turbo since it doesn't support OpenAI's Structured Output API. You can see supported models here: https://platform.openai.com/docs/guides/structured-outputs#supported-models. To fix this warning, set `method='function_calling'. Overriding to method='function_calling'.
|
545
|
+
# warnings.warn(
|
546
|
+
# Async Pydantic Chunk 0: proposition_topic='The Meaning of Life' proposition_content=''
|
547
|
+
# Async Pydantic Chunk 1: proposition_topic='The Meaning of Life' proposition_content='The'
|
548
|
+
# Async Pydantic Chunk 2: proposition_topic='The Meaning of Life' proposition_content='The meaning'
|
549
|
+
# Async Pydantic Chunk 3: proposition_topic='The Meaning of Life' proposition_content='The meaning of'
|
550
|
+
# Async Pydantic Chunk 4: proposition_topic='The Meaning of Life' proposition_content='The meaning of life'
|
551
|
+
# Async Pydantic Chunk 5: proposition_topic='The Meaning of Life' proposition_content='The meaning of life is'
|
552
|
+
# Async Pydantic Chunk 6: proposition_topic='The Meaning of Life' proposition_content='The meaning of life is a'
|
553
|
+
# Async Pydantic Chunk 7: proposition_topic='The Meaning of Life' proposition_content='The meaning of life is a philosophical'
|
554
|
+
# Async Pydantic Chunk 8: proposition_topic='The Meaning of Life' proposition_content='The meaning of life is a philosophical question'
|
555
|
+
# Async Pydantic Chunk 9: proposition_topic='The Meaning of Life' proposition_content='The meaning of life is a philosophical question that'
|
556
|
+
# Async Pydantic Chunk 10: proposition_topic='The Meaning of Life' proposition_content='The meaning of life is a philosophical question that seeks'
|
557
|
+
# Async Pydantic Chunk 11: proposition_topic='The Meaning of Life' proposition_content='The meaning of life is a philosophical question that seeks to'
|
558
|
+
# Async Pydantic Chunk 12: proposition_topic='The Meaning of Life' proposition_content='The meaning of life is a philosophical question that seeks to understand'
|
559
|
+
# Async Pydantic Chunk 13: proposition_topic='The Meaning of Life' proposition_content='The meaning of life is a philosophical question that seeks to understand the'
|
560
|
+
# Async Pydantic Chunk 14: proposition_topic='The Meaning of Life' proposition_content='The meaning of life is a philosophical question that seeks to understand the purpose'
|
561
|
+
# Async Pydantic Chunk 15: proposition_topic='The Meaning of Life' proposition_content='The meaning of life is a philosophical question that seeks to understand the purpose and'
|
562
|
+
# Async Pydantic Chunk 16: proposition_topic='The Meaning of Life' proposition_content='The meaning of life is a philosophical question that seeks to understand the purpose and significance'
|
563
|
+
# Async Pydantic Chunk 17: proposition_topic='The Meaning of Life' proposition_content='The meaning of life is a philosophical question that seeks to understand the purpose and significance of'
|
564
|
+
# Async Pydantic Chunk 18: proposition_topic='The Meaning of Life' proposition_content='The meaning of life is a philosophical question that seeks to understand the purpose and significance of human'
|
565
|
+
# Async Pydantic Chunk 19: proposition_topic='The Meaning of Life' proposition_content='The meaning of life is a philosophical question that seeks to understand the purpose and significance of human existence'
|
566
|
+
# Async Pydantic Chunk 20: proposition_topic='The Meaning of Life' proposition_content='The meaning of life is a philosophical question that seeks to understand the purpose and significance of human existence.'
|
567
|
+
# Async Pydantic Chunk 21: proposition_topic='The Meaning of Life' proposition_content='The meaning of life is a philosophical question that seeks to understand the purpose and significance of human existence. It'
|
568
|
+
# Async Pydantic Chunk 22: proposition_topic='The Meaning of Life' proposition_content='The meaning of life is a philosophical question that seeks to understand the purpose and significance of human existence. It is'
|
569
|
+
# Async Pydantic Chunk 23: proposition_topic='The Meaning of Life' proposition_content='The meaning of life is a philosophical question that seeks to understand the purpose and significance of human existence. It is a'
|
570
|
+
# Async Pydantic Chunk 24: proposition_topic='The Meaning of Life' proposition_content='The meaning of life is a philosophical question that seeks to understand the purpose and significance of human existence. It is a profound'
|
571
|
+
# Async Pydantic Chunk 25: proposition_topic='The Meaning of Life' proposition_content='The meaning of life is a philosophical question that seeks to understand the purpose and significance of human existence. It is a profound and'
|
572
|
+
# Async Pydantic Chunk 26: proposition_topic='The Meaning of Life' proposition_content='The meaning of life is a philosophical question that seeks to understand the purpose and significance of human existence. It is a profound and complex'
|
573
|
+
# Async Pydantic Chunk 27: proposition_topic='The Meaning of Life' proposition_content='The meaning of life is a philosophical question that seeks to understand the purpose and significance of human existence. It is a profound and complex topic'
|
574
|
+
# Async Pydantic Chunk 28: proposition_topic='The Meaning of Life' proposition_content='The meaning of life is a philosophical question that seeks to understand the purpose and significance of human existence. It is a profound and complex topic that'
|
575
|
+
# Async Pydantic Chunk 29: proposition_topic='The Meaning of Life' proposition_content='The meaning of life is a philosophical question that seeks to understand the purpose and significance of human existence. It is a profound and complex topic that has'
|
576
|
+
# Async Pydantic Chunk 30: proposition_topic='The Meaning of Life' proposition_content='The meaning of life is a philosophical question that seeks to understand the purpose and significance of human existence. It is a profound and complex topic that has been'
|
577
|
+
# Async Pydantic Chunk 31: proposition_topic='The Meaning of Life' proposition_content='The meaning of life is a philosophical question that seeks to understand the purpose and significance of human existence. It is a profound and complex topic that has been debated'
|
578
|
+
# Async Pydantic Chunk 32: proposition_topic='The Meaning of Life' proposition_content='The meaning of life is a philosophical question that seeks to understand the purpose and significance of human existence. It is a profound and complex topic that has been debated and'
|
579
|
+
# Async Pydantic Chunk 33: proposition_topic='The Meaning of Life' proposition_content='The meaning of life is a philosophical question that seeks to understand the purpose and significance of human existence. It is a profound and complex topic that has been debated and explored'
|
580
|
+
# Async Pydantic Chunk 34: proposition_topic='The Meaning of Life' proposition_content='The meaning of life is a philosophical question that seeks to understand the purpose and significance of human existence. It is a profound and complex topic that has been debated and explored by'
|
581
|
+
# Async Pydantic Chunk 35: proposition_topic='The Meaning of Life' proposition_content='The meaning of life is a philosophical question that seeks to understand the purpose and significance of human existence. It is a profound and complex topic that has been debated and explored by philosophers'
|
582
|
+
# Async Pydantic Chunk 36: proposition_topic='The Meaning of Life' proposition_content='The meaning of life is a philosophical question that seeks to understand the purpose and significance of human existence. It is a profound and complex topic that has been debated and explored by philosophers,'
|
583
|
+
# Async Pydantic Chunk 37: proposition_topic='The Meaning of Life' proposition_content='The meaning of life is a philosophical question that seeks to understand the purpose and significance of human existence. It is a profound and complex topic that has been debated and explored by philosophers, theolog'
|
584
|
+
# Async Pydantic Chunk 38: proposition_topic='The Meaning of Life' proposition_content='The meaning of life is a philosophical question that seeks to understand the purpose and significance of human existence. It is a profound and complex topic that has been debated and explored by philosophers, theologians'
|
585
|
+
# Async Pydantic Chunk 39: proposition_topic='The Meaning of Life' proposition_content='The meaning of life is a philosophical question that seeks to understand the purpose and significance of human existence. It is a profound and complex topic that has been debated and explored by philosophers, theologians,'
|
586
|
+
# Async Pydantic Chunk 40: proposition_topic='The Meaning of Life' proposition_content='The meaning of life is a philosophical question that seeks to understand the purpose and significance of human existence. It is a profound and complex topic that has been debated and explored by philosophers, theologians, and'
|
587
|
+
# Async Pydantic Chunk 41: proposition_topic='The Meaning of Life' proposition_content='The meaning of life is a philosophical question that seeks to understand the purpose and significance of human existence. It is a profound and complex topic that has been debated and explored by philosophers, theologians, and thinkers'
|
588
|
+
# Async Pydantic Chunk 42: proposition_topic='The Meaning of Life' proposition_content='The meaning of life is a philosophical question that seeks to understand the purpose and significance of human existence. It is a profound and complex topic that has been debated and explored by philosophers, theologians, and thinkers throughout'
|
589
|
+
# Async Pydantic Chunk 43: proposition_topic='The Meaning of Life' proposition_content='The meaning of life is a philosophical question that seeks to understand the purpose and significance of human existence. It is a profound and complex topic that has been debated and explored by philosophers, theologians, and thinkers throughout history'
|
590
|
+
# Async Pydantic Chunk 44: proposition_topic='The Meaning of Life' proposition_content='The meaning of life is a philosophical question that seeks to understand the purpose and significance of human existence. It is a profound and complex topic that has been debated and explored by philosophers, theologians, and thinkers throughout history.'
|
@@ -0,0 +1,19 @@
|
|
1
|
+
from .atom_of_thoughts import (
|
2
|
+
AoTPipeline,
|
3
|
+
AoTStrategy,
|
4
|
+
BaseAoTPrompter,
|
5
|
+
CodingAoTPrompter,
|
6
|
+
GeneralAoTPrompter,
|
7
|
+
PhilosophyAoTPrompter,
|
8
|
+
)
|
9
|
+
from .base import BaseStrategy
|
10
|
+
|
11
|
+
__all__ = [
|
12
|
+
"BaseStrategy",
|
13
|
+
"AoTPipeline",
|
14
|
+
"BaseAoTPrompter",
|
15
|
+
"AoTStrategy",
|
16
|
+
"GeneralAoTPrompter",
|
17
|
+
"CodingAoTPrompter",
|
18
|
+
"PhilosophyAoTPrompter",
|
19
|
+
]
|