sk1502 commited on
Commit
46f65a5
·
1 Parent(s): 3d0c18b

Code update

Browse files
Files changed (6) hide show
  1. .chainlit/config.toml +3 -3
  2. .gitignore +2 -1
  3. aisearch_v1.py +12 -6
  4. app.py +7 -3
  5. public/logo_light.png +0 -0
  6. public/theme.json +68 -0
.chainlit/config.toml CHANGED
@@ -33,7 +33,7 @@ edit_message = true
33
 
34
  # Authorize users to spontaneously upload files with messages
35
  [features.spontaneous_file_upload]
36
- enabled = true
37
  # Define accepted file types using MIME types
38
  # Examples:
39
  # 1. For specific file types:
@@ -53,9 +53,9 @@ edit_message = true
53
 
54
  [UI]
55
  # Name of the assistant.
56
- name = "Assistant"
57
 
58
- # default_theme = "dark"
59
 
60
  # layout = "wide"
61
 
 
33
 
34
  # Authorize users to spontaneously upload files with messages
35
  [features.spontaneous_file_upload]
36
+ enabled = false
37
  # Define accepted file types using MIME types
38
  # Examples:
39
  # 1. For specific file types:
 
53
 
54
  [UI]
55
  # Name of the assistant.
56
+ name = "Docuswift Legal Search"
57
 
58
+ default_theme = "light"
59
 
60
  # layout = "wide"
61
 
.gitignore CHANGED
@@ -5,7 +5,8 @@ __pycache__/
5
 
6
  # C extensions
7
  *.so
8
- *.json
 
9
 
10
  # Distribution / packaging
11
  .Python
 
5
 
6
  # C extensions
7
  *.so
8
+ translations/
9
+ # *.json
10
 
11
  # Distribution / packaging
12
  .Python
aisearch_v1.py CHANGED
@@ -29,6 +29,12 @@ az_client = AsyncAzureOpenAI(
29
  azure_endpoint=os.environ.get('AZURE_OPENAI_ENDPOINT')
30
  )
31
 
 
 
 
 
 
 
32
  class ReportResponse(BaseModel):
33
  title : str
34
  justification : str
@@ -123,11 +129,11 @@ class aiSearch:
123
  </output format>"""
124
 
125
  async def gpt4omini(self,query):
126
- chat_completion = await az_client.chat.completions.create(
127
  messages=[
128
  {
129
  "role" : "system",
130
- "content" : self.research_prompt
131
  },
132
  {
133
  "role": "user",
@@ -135,13 +141,13 @@ class aiSearch:
135
  }
136
  ],
137
  stream=True,
138
- model="gpt4o-mini",
139
- # temperature=0,
140
  # reasoning_effort='low',
141
  # response_format=ReportResponse
142
  )
143
 
144
- return chat_completion.choices[0].message.content
145
 
146
  async def o3_mini(self,query):
147
  chat_completion = await az_client.beta.chat.completions.parse(
@@ -307,5 +313,5 @@ class aiSearch:
307
  reports = [resp for resp in batch_responses]
308
  print(reports)
309
 
310
- stream_responses = await self.gemini(str(reports))
311
  return stream_responses
 
29
  azure_endpoint=os.environ.get('AZURE_OPENAI_ENDPOINT')
30
  )
31
 
32
+ az_client_in = AsyncAzureOpenAI(
33
+ api_key=os.environ.get('AZURE_OPENAI_API_KEY_IN'),
34
+ api_version="2024-12-01-preview", # Use the appropriate API version
35
+ azure_endpoint=os.environ.get('AZURE_OPENAI_ENDPOINT_IN')
36
+ )
37
+
38
  class ReportResponse(BaseModel):
39
  title : str
40
  justification : str
 
129
  </output format>"""
130
 
131
  async def gpt4omini(self,query):
132
+ chat_completion = await az_client_in.chat.completions.create(
133
  messages=[
134
  {
135
  "role" : "system",
136
+ "content" : self.sp_final_report
137
  },
138
  {
139
  "role": "user",
 
141
  }
142
  ],
143
  stream=True,
144
+ model="gpt-4o-mini",
145
+ temperature=0,
146
  # reasoning_effort='low',
147
  # response_format=ReportResponse
148
  )
149
 
150
+ return chat_completion
151
 
152
  async def o3_mini(self,query):
153
  chat_completion = await az_client.beta.chat.completions.parse(
 
313
  reports = [resp for resp in batch_responses]
314
  print(reports)
315
 
316
+ stream_responses = await self.gpt4omini(str(reports))
317
  return stream_responses
app.py CHANGED
@@ -34,9 +34,13 @@ async def main(message: cl.Message):
34
  # await cl.Message(content=result).send()
35
 
36
  # for stream in streams:
37
- async for part in streams:
38
- if token := part.text or "":
39
- await msg.stream_token(token)
 
 
 
 
40
 
41
  # # After streaming is complete, add citations if available
42
  # if sources and len(sources) > 0:
 
34
  # await cl.Message(content=result).send()
35
 
36
  # for stream in streams:
37
+ # async for part in streams:
38
+ # if token := part.text or "":
39
+ # await msg.stream_token(token)
40
+
41
+ async for update in streams:
42
+ if update.choices:
43
+ await msg.stream_token(update.choices[0].delta.content or "")
44
 
45
  # # After streaming is complete, add citations if available
46
  # if sources and len(sources) > 0:
public/logo_light.png ADDED
public/theme.json ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "custom_fonts": [],
3
+ "variables": {
4
+ "light": {
5
+ "--font-sans": "'Inter', sans-serif",
6
+ "--font-mono": "source-code-pro, Menlo, Monaco, Consolas, 'Courier New', monospace",
7
+ "--background": "0 0% 100%",
8
+ "--foreground": "0 0% 5%",
9
+ "--card": "0 0% 100%",
10
+ "--card-foreground": "0 0% 5%",
11
+ "--popover": "0 0% 100%",
12
+ "--popover-foreground": "0 0% 5%",
13
+ "--primary": "230, 100%, 50%",
14
+ "--primary-foreground": "0 0% 100%",
15
+ "--secondary": "210 40% 96.1%",
16
+ "--secondary-foreground": "222.2 47.4% 11.2%",
17
+ "--muted": "0 0% 90%",
18
+ "--muted-foreground": "0 0% 36%",
19
+ "--accent": "0 0% 95%",
20
+ "--accent-foreground": "222.2 47.4% 11.2%",
21
+ "--destructive": "0 84.2% 60.2%",
22
+ "--destructive-foreground": "210 40% 98%",
23
+ "--border": "0 0% 90%",
24
+ "--input": "0 0% 90%",
25
+ "--ring": "340 92% 52%",
26
+ "--radius": "0.75rem",
27
+ "--sidebar-background": "0 0% 98%",
28
+ "--sidebar-foreground": "240 5.3% 26.1%",
29
+ "--sidebar-primary": "240 5.9% 10%",
30
+ "--sidebar-primary-foreground": "0 0% 98%",
31
+ "--sidebar-accent": "240 4.8% 95.9%",
32
+ "--sidebar-accent-foreground": "240 5.9% 10%",
33
+ "--sidebar-border": "220 13% 91%",
34
+ "--sidebar-ring": "217.2 91.2% 59.8%"
35
+ },
36
+ "dark": {
37
+ "--font-sans": "'Inter', sans-serif",
38
+ "--font-mono": "source-code-pro, Menlo, Monaco, Consolas, 'Courier New', monospace",
39
+ "--background": "0 0% 13%",
40
+ "--foreground": "0 0% 93%",
41
+ "--card": "0 0% 18%",
42
+ "--card-foreground": "210 40% 98%",
43
+ "--popover": "0 0% 18%",
44
+ "--popover-foreground": "210 40% 98%",
45
+ "--primary": "340 92% 52%",
46
+ "--primary-foreground": "0 0% 100%",
47
+ "--secondary": "0 0% 19%",
48
+ "--secondary-foreground": "210 40% 98%",
49
+ "--muted": "0 1% 26%",
50
+ "--muted-foreground": "0 0% 71%",
51
+ "--accent": "0 0% 26%",
52
+ "--accent-foreground": "210 40% 98%",
53
+ "--destructive": "0 62.8% 30.6%",
54
+ "--destructive-foreground": "210 40% 98%",
55
+ "--border": "0 1% 26%",
56
+ "--input": "0 1% 26%",
57
+ "--ring": "340 92% 52%",
58
+ "--sidebar-background": "0 0% 9%",
59
+ "--sidebar-foreground": "240 4.8% 95.9%",
60
+ "--sidebar-primary": "224.3 76.3% 48%",
61
+ "--sidebar-primary-foreground": "0 0% 100%",
62
+ "--sidebar-accent": "0 0% 13%",
63
+ "--sidebar-accent-foreground": "240 4.8% 95.9%",
64
+ "--sidebar-border": "240 3.7% 15.9%",
65
+ "--sidebar-ring": "217.2 91.2% 59.8%"
66
+ }
67
+ }
68
+ }