Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Header fix #63

Merged
merged 9 commits into from
Nov 28, 2024
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ client.datasources.drop('my_datasource')
- [Java-SDK](https://github.com/Better-Boy/minds-java-sdk)
- [Ruby-SDK](https://github.com/tungnt1203/minds_ruby_sdk)
- [Dart-SDK](https://github.com/ArnavK-09/mdb_dart)
- [Javascript](https://github.com/scshiv29-dev/mindsbd_sdk_js)
- [C# SDK](https://github.com/priyanshuverma-dev/Minds.SDK)
- [Go SDK](https://github.com/Abiji-2020/minds-go-sdk)

Expand Down
5 changes: 3 additions & 2 deletions minds/knowledge_bases/knowledge_bases.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ def create(self, config: KnowledgeBaseConfig) -> KnowledgeBase:
if config.vector_store_config is not None:
vector_store_data = {
'engine': config.vector_store_config.engine,
'connection_data': config.vector_store_config.connection_data
'connection_data': config.vector_store_config.connection_data,
'table': config.vector_store_config.table
}
create_request['vector_store'] = vector_store_data
if config.embedding_config is not None:
Expand Down Expand Up @@ -168,7 +169,7 @@ def drop(self, name: str, force=False):
:param name: name of knowledge base
:param force: if True - remove from all minds, default: False
'''
data = None
data = {}
if force:
data = {'cascade': True}

Expand Down
10 changes: 5 additions & 5 deletions minds/rest_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ def __init__(self, api_key, base_url=None):
self.base_url = base_url

def _headers(self):
return {'Authorization': 'Bearer ' + self.api_key}
return {'Authorization': 'Bearer ' + self.api_key, 'Content-Type': 'application/json',}

def get(self, url):
resp = requests.get(self.base_url + url, headers=self._headers())

_raise_for_status(resp)
return resp

def delete(self, url, data=None):
def delete(self, url, data={}):
resp = requests.delete(
self.base_url + url,
headers=self._headers(),
Expand All @@ -47,7 +47,7 @@ def delete(self, url, data=None):
_raise_for_status(resp)
return resp

def post(self, url, data):
def post(self, url, data={}):
resp = requests.post(
self.base_url + url,
headers=self._headers(),
Expand All @@ -57,7 +57,7 @@ def post(self, url, data):
_raise_for_status(resp)
return resp

def put(self, url, data):
def put(self, url, data={}):
resp = requests.put(
self.base_url + url,
headers=self._headers(),
Expand All @@ -67,7 +67,7 @@ def put(self, url, data):
_raise_for_status(resp)
return resp

def patch(self, url, data):
def patch(self, url, data={}):
resp = requests.patch(
self.base_url + url,
headers=self._headers(),
Expand Down
Loading