forked from BasedHardware/omi
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstream_test.py
More file actions
140 lines (131 loc) · 4.61 KB
/
Copy pathstream_test.py
File metadata and controls
140 lines (131 loc) · 4.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
import asyncio
import os
from typing import Any, cast
from dotenv import load_dotenv
dotenv_dir = os.path.join(os.path.dirname(__file__), '../../')
load_dotenv(dotenv_path=f'{dotenv_dir}/.env')
os.environ['GOOGLE_APPLICATION_CREDENTIALS'] = f"{dotenv_dir}/google-credentials.json"
from langchain_openai import ChatOpenAI, OpenAIEmbeddings
llm_mini = ChatOpenAI(model='gpt-4o-mini')
embeddings = OpenAIEmbeddings(model="text-embedding-3-large")
import routers.chat as chat_routers
async def test_stream():
# uid = "eLCx***"
response: Any = chat_routers.send_message( # type: ignore[reportCallIssue] # test script with commented-out params
# data=chat_models.SendMessageRequest(
# text="Did i discuss anything abt yacht party recently? If yes do you think that partnership makes sense for us",
# file_ids=[], # ['x']
# ),
# uid=uid,
# data=chat_models.SendMessageRequest(
# text="what did i discuss 2 hour ago",
# file_ids=[], # ['x']
# ),
# uid=uid,
# data=chat_models.SendMessageRequest(
# text="what did i discuss today",
# file_ids=[], # ['x']
# ),
# uid=uid,
# data=chat_models.SendMessageRequest(
# text="what did i discuss on oct 17",
# file_ids=[], # ['x']
# ),
# uid=uid,
# data=chat_models.SendMessageRequest(
# text="what did i discuss at 520 pm",
# file_ids=[], # ['x']
# ),
# uid=uid,
# data=chat_models.SendMessageRequest(
# text="summarise my month",
# file_ids=[], # ['x']
# ),
# uid=uid,
# data=chat_models.SendMessageRequest(
# text="what did i discuss in the last 3 hours ago",
# file_ids=[], # ['x']
# ),
# uid=uid,
#
# data=chat_models.SendMessageRequest(
# text="I talked to a guy today who has experience hosting events, what does their startup do",
# file_ids=[], # ['x']
# ),
# uid=uid,
# data=chat_models.SendMessageRequest(
# text="where did i have dinner last night",
# file_ids=[], # ['x']
# ),
# uid=uid,
# data=chat_models.SendMessageRequest(
# text="what did i talk about firmware recently",
# file_ids=[], # ['x']
# ),
# uid=uid,
# data=chat_models.SendMessageRequest(
# text="i have talked to my team about rolling out the subscription plan. can you check my discussions and suggest what the better plan is ?",
# file_ids=[], # ['x']
# ),
# uid=uid,
### MEMORIES TOOLS
#
# data=chat_models.SendMessageRequest(
# text="what memories do i have 2 hours ago",
# file_ids=[], # ['x']
# ),
# uid=uid,
# data=chat_models.SendMessageRequest(
# text="what memories do i have on oct 13",
# file_ids=[], # ['x']
# ),
# uid=uid,
# data=chat_models.SendMessageRequest(
# text="what memories do i have at 520pm oct 17",
# file_ids=[], # ['x']
# ),
# uid=uid,
### ACTION ITEMS
#
# data=chat_models.SendMessageRequest(
# text="what action items do i have 2 hours ago",
# file_ids=[], # ['x']
# ),
# uid=uid,
# data=chat_models.SendMessageRequest(
# text="what action items do i have on oct 19",
# file_ids=[], # ['x']
# ),
# uid=uid,
# data=chat_models.SendMessageRequest(
# text="remind me to check the omi chat discussion on github",
# file_ids=[], # ['x']
# ),
# uid=uid,
#
# OMI docs
#
# data=chat_models.SendMessageRequest(
# text="how to flash the omi consumer cv1 firmware ?",
# file_ids=[], # ['x']
# ),
# uid=uid,
# data=chat_models.SendMessageRequest(
# text="what did i discuss 3 hours ago",
# file_ids=[], # ['x']
# ),
# uid=uid,
# data=chat_models.SendMessageRequest(
# text="what did i discuss in the last 3 hours ago",
# file_ids=[], # ['x']
# ),
# uid=uid,
)
# Read the stream
async for chunk in cast(Any, response).body_iterator:
if isinstance(chunk, bytes):
print(chunk.decode('utf-8'))
else:
print(chunk) # Already a string
if __name__ == '__main__':
asyncio.run(test_stream())