Skip to content

Commit 354c248

Browse files
fixed circular imports and added missing params
1 parent 97248bf commit 354c248

File tree

2 files changed

+20
-12
lines changed

2 files changed

+20
-12
lines changed

minds/datasources/datasources.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
from typing import List, Optional
1+
from typing import List, Optional, TYPE_CHECKING
22

33
from pydantic import BaseModel
44

5-
from minds.client import Client
65
import minds.exceptions as exc
76
import minds.utils as utils
87

8+
if TYPE_CHECKING:
9+
from minds.client import Client
10+
911

1012
class Datasource(BaseModel):
1113
"""
@@ -15,10 +17,12 @@ class Datasource(BaseModel):
1517
engine: str
1618
description: Optional[str] = None
1719
connection_data: Optional[dict] = None
20+
created_at: str
21+
modified_at: str
1822

1923

2024
class Datasources:
21-
def __init__(self, client: Client):
25+
def __init__(self, client: 'Client'):
2226
self.api = client.api
2327

2428
def create(

minds/minds.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,24 @@
11
from openai import OpenAI
2-
from typing import Dict, List, Optional, Union, Iterable
2+
from typing import Dict, List, Optional, Union, Iterable, TYPE_CHECKING
33

4-
from minds.client import Client
54
import minds.exceptions as exc
65
import minds.utils as utils
76
# from minds.knowledge_bases import KnowledgeBase, KnowledgeBaseConfig
87

8+
if TYPE_CHECKING:
9+
from minds.client import Client
10+
911

1012
class Mind:
1113
def __init__(
1214
self,
13-
client: Client,
15+
client: 'Client',
1416
name: str,
1517
model_name: str,
1618
provider: str,
1719
# knowledge_bases=None,
1820
created_at: str,
19-
updated_at: str,
21+
modified_at: str,
2022
status: str,
2123
datasources: Optional[List[Dict]] = [],
2224
parameters: Optional[Dict] = {},
@@ -30,7 +32,7 @@ def __init__(
3032
self.provider = provider
3133
self.parameters = parameters if parameters is not None else {}
3234
self.created_at = created_at
33-
self.updated_at = updated_at
35+
self.modified_at = modified_at
3436
self.datasources = datasources
3537
# self.knowledge_bases = knowledge_bases
3638
self.status = status
@@ -40,7 +42,7 @@ def __repr__(self):
4042
f'model_name={self.model_name}, '
4143
f'provider={self.provider}, '
4244
f'created_at="{self.created_at}", '
43-
f'updated_at="{self.updated_at}", '
45+
f'modified_at="{self.modified_at}", '
4446
f'parameters={self.parameters}, '
4547
# f'knowledge_bases={self.knowledge_bases}, '
4648
f'datasources={self.datasources}, '
@@ -154,7 +156,7 @@ def _stream_response(self, response) -> Iterable[str]:
154156

155157

156158
class Minds:
157-
def __init__(self, client: Client):
159+
def __init__(self, client: 'Client'):
158160
self.api = client.api
159161
self.client = client
160162

@@ -243,10 +245,12 @@ def create(
243245

244246
data = {
245247
'name': name,
246-
'model_name': model_name,
247-
'provider': provider,
248248
'datasources': datasources or [],
249249
}
250+
if model_name:
251+
data['model_name'] = model_name
252+
if provider:
253+
data['provider'] = provider
250254
if parameters:
251255
data['parameters'] = parameters
252256
# if kb_names:

0 commit comments

Comments
 (0)