typeagent-py 0.1.0__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 (55) hide show
  1. typeagent/aitools/auth.py +61 -0
  2. typeagent/aitools/embeddings.py +232 -0
  3. typeagent/aitools/utils.py +244 -0
  4. typeagent/aitools/vectorbase.py +175 -0
  5. typeagent/knowpro/answer_context_schema.py +49 -0
  6. typeagent/knowpro/answer_response_schema.py +34 -0
  7. typeagent/knowpro/answers.py +577 -0
  8. typeagent/knowpro/collections.py +759 -0
  9. typeagent/knowpro/common.py +9 -0
  10. typeagent/knowpro/convknowledge.py +112 -0
  11. typeagent/knowpro/convsettings.py +94 -0
  12. typeagent/knowpro/convutils.py +49 -0
  13. typeagent/knowpro/date_time_schema.py +32 -0
  14. typeagent/knowpro/field_helpers.py +87 -0
  15. typeagent/knowpro/fuzzyindex.py +144 -0
  16. typeagent/knowpro/interfaces.py +818 -0
  17. typeagent/knowpro/knowledge.py +88 -0
  18. typeagent/knowpro/kplib.py +125 -0
  19. typeagent/knowpro/query.py +1128 -0
  20. typeagent/knowpro/search.py +628 -0
  21. typeagent/knowpro/search_query_schema.py +165 -0
  22. typeagent/knowpro/searchlang.py +729 -0
  23. typeagent/knowpro/searchlib.py +345 -0
  24. typeagent/knowpro/secindex.py +100 -0
  25. typeagent/knowpro/serialization.py +390 -0
  26. typeagent/knowpro/textlocindex.py +179 -0
  27. typeagent/knowpro/utils.py +17 -0
  28. typeagent/mcp/server.py +139 -0
  29. typeagent/podcasts/podcast.py +473 -0
  30. typeagent/podcasts/podcast_import.py +105 -0
  31. typeagent/storage/__init__.py +25 -0
  32. typeagent/storage/memory/__init__.py +13 -0
  33. typeagent/storage/memory/collections.py +68 -0
  34. typeagent/storage/memory/convthreads.py +81 -0
  35. typeagent/storage/memory/messageindex.py +178 -0
  36. typeagent/storage/memory/propindex.py +289 -0
  37. typeagent/storage/memory/provider.py +84 -0
  38. typeagent/storage/memory/reltermsindex.py +318 -0
  39. typeagent/storage/memory/semrefindex.py +660 -0
  40. typeagent/storage/memory/timestampindex.py +176 -0
  41. typeagent/storage/sqlite/__init__.py +31 -0
  42. typeagent/storage/sqlite/collections.py +362 -0
  43. typeagent/storage/sqlite/messageindex.py +382 -0
  44. typeagent/storage/sqlite/propindex.py +119 -0
  45. typeagent/storage/sqlite/provider.py +293 -0
  46. typeagent/storage/sqlite/reltermsindex.py +328 -0
  47. typeagent/storage/sqlite/schema.py +248 -0
  48. typeagent/storage/sqlite/semrefindex.py +156 -0
  49. typeagent/storage/sqlite/timestampindex.py +146 -0
  50. typeagent/storage/utils.py +41 -0
  51. typeagent_py-0.1.0.dist-info/METADATA +28 -0
  52. typeagent_py-0.1.0.dist-info/RECORD +55 -0
  53. typeagent_py-0.1.0.dist-info/WHEEL +5 -0
  54. typeagent_py-0.1.0.dist-info/licenses/LICENSE +21 -0
  55. typeagent_py-0.1.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,165 @@
1
+ # Copyright (c) Microsoft Corporation.
2
+ # Licensed under the MIT License.
3
+
4
+ # TODO: Move this file into knowpro.
5
+
6
+ from pydantic.dataclasses import dataclass
7
+ from pydantic import Field
8
+ from typing import Annotated, Literal
9
+ from typing_extensions import Doc
10
+
11
+ from .field_helpers import CamelCaseField
12
+ from .date_time_schema import DateTimeRange
13
+
14
+
15
+ @dataclass
16
+ class FacetTerm:
17
+ facet_name: Annotated[
18
+ str,
19
+ Doc(
20
+ "The name of the facet, such as 'color', 'profession', 'patent number'; "
21
+ "'*' means match any facet name."
22
+ ),
23
+ ]
24
+ facet_value: Annotated[
25
+ str,
26
+ Doc(
27
+ "The value of the facet, such as 'red', 'writer'; "
28
+ "'*' means match any facet value."
29
+ ),
30
+ ]
31
+
32
+
33
+ @dataclass
34
+ class EntityTerm:
35
+ """
36
+ Use to find information about specific, tangible people, places, institutions or things only.
37
+ This includes entities with particular facets.
38
+ Abstract concepts or topics are not entityTerms. Use string for them.
39
+ Any terms will match fuzzily.
40
+ """
41
+
42
+ name: Annotated[
43
+ str,
44
+ Doc(
45
+ "The name of the entity or thing such as 'Bach', 'Great Gatsby', 'frog' or 'piano' or 'we', 'I'; "
46
+ "'*' means match any entity name."
47
+ ),
48
+ ]
49
+ is_name_pronoun: bool
50
+ type: Annotated[
51
+ list[str] | None,
52
+ Doc(
53
+ "The specific types of the entity such as 'book', 'movie', 'song', 'speaker', "
54
+ "'person', 'artist', 'animal', 'instrument', 'school', 'room', 'museum', 'food' etc.\n"
55
+ "Generic types like 'object', 'thing' etc. are NOT allowed.\n"
56
+ "An entity can have multiple types; entity types should be single words."
57
+ ),
58
+ ] = None
59
+ facets: Annotated[
60
+ list[FacetTerm] | None,
61
+ Doc(
62
+ "Facet terms search for properties or attributes of the entity.\n"
63
+ "E.g.: color(blue), profession(writer), author(*), aunt(Agatha), weight(4kg), phoneNumber(...), etc."
64
+ ),
65
+ ] = None
66
+
67
+
68
+ @dataclass
69
+ class VerbsTerm:
70
+ words: Annotated[list[str], Doc("Individual words in single or compound verb.")]
71
+ tense: Literal["Past", "Present", "Future"] = "Present"
72
+
73
+
74
+ @dataclass
75
+ class ActionTerm:
76
+ actor_entities: Annotated[
77
+ list[EntityTerm] | Literal["*"],
78
+ Doc(
79
+ "The origin of the action or information, typically the entity performing the action."
80
+ ),
81
+ ]
82
+ is_informational: Annotated[
83
+ bool,
84
+ Doc(
85
+ "Is the intent of the phrase translated to this ActionTerm "
86
+ "to actually get information about specific entities?\n"
87
+ "Examples:\n"
88
+ "True: if asking for specific information about an entity, "
89
+ "such as 'What is Mia's phone number?' or 'Where did Jane study?\n"
90
+ "False: if involves actions and interactions between entities, "
91
+ "such as 'What phone number did Mia mention in her note to Jane?'"
92
+ ),
93
+ ]
94
+ action_verbs: Annotated[
95
+ VerbsTerm | None, Doc("Action verbs describing the interaction.")
96
+ ] = None
97
+ target_entities: Annotated[
98
+ list[EntityTerm] | None,
99
+ Doc(
100
+ "The recipient or target of the action or information.\n"
101
+ "Action verbs can imply relevant facet names on the targetEntity. "
102
+ "E.g. write -> writer, sing -> singer etc."
103
+ ),
104
+ ] = None
105
+ additional_entities: Annotated[
106
+ list[EntityTerm] | None,
107
+ Doc(
108
+ "Additional entities participating in the action.\n"
109
+ "E.g. in the phrase 'Jane ate the spaghetti with the fork', "
110
+ "'the fork' would be an additional entity.\n"
111
+ "E.g. in the phrase 'Did Jane speak about Bach with Nina', "
112
+ "'Bach' would be the additional entity."
113
+ ),
114
+ ] = None
115
+
116
+
117
+ @dataclass
118
+ class SearchFilter:
119
+ """
120
+ Specifies the search terms for a search expression.
121
+ Make sure at least one field below is present and not None nor empty.
122
+ entity_search_terms cannot contain entities already in action_search_terms.
123
+ """
124
+
125
+ action_search_term: ActionTerm | None = None
126
+ entity_search_terms: list[EntityTerm] | None = None
127
+ search_terms: Annotated[
128
+ list[str] | None,
129
+ Doc(
130
+ "search_terms:\n"
131
+ "Concepts, topics or other terms that don't fit ActionTerms or EntityTerms.\n"
132
+ "- Do not use noisy searchTerms like 'topic', 'topics', 'subject', "
133
+ "'discussion' etc. even if they are mentioned in the user request.\n"
134
+ "- Phrases like 'email address' or 'first name' are a single term.\n"
135
+ "- Use empty searchTerms array when use asks for summaries."
136
+ ),
137
+ ] = None
138
+ time_range: Annotated[
139
+ DateTimeRange | None,
140
+ Doc(
141
+ "Use only if request explicitly asks for time range, particular year, month etc.\n"
142
+ "in this time range."
143
+ ),
144
+ ] = None
145
+
146
+
147
+ @dataclass
148
+ class SearchExpr:
149
+ rewritten_query: Annotated[
150
+ str,
151
+ Doc("The rewritten search query"),
152
+ CamelCaseField(field_name="rewritten_query"),
153
+ ]
154
+ filters: Annotated[list[SearchFilter], Doc("List of search filters")]
155
+
156
+
157
+ @dataclass
158
+ class SearchQuery:
159
+ search_expressions: Annotated[
160
+ list[SearchExpr],
161
+ Doc(
162
+ "One expression for each search required by user request. Each SearchExpr runs independently, so make them standalone by resolving references like 'it', 'that', 'them' etc."
163
+ ),
164
+ CamelCaseField(field_name="search_expressions"),
165
+ ]