Skip to content

memas-ai/MeMaS-python-sdk

Repository files navigation

memas-sdk

This is the Control Plane and Data Plane API clients for MeMaS (Memory Management Service). See https://github.com/memas-ai/MeMaS for more details.

This Python package is automatically generated by the OpenAPI Generator project:

  • API version: 0.1.1
  • Package version: 0.1.3
  • Build package: org.openapitools.codegen.languages.PythonClientCodegen

Requirements.

Python >=3.7

Installation & Usage

pip install

If the python package is hosted on a repository, you can install directly using:

pip install git+https://github.com/memas-ai/MeMaS-python-sdk.git

(you may need to run pip with root permission: sudo pip install git+https://github.com/memas-ai/MeMaS-python-sdk.git)

Then import the package:

import memas_sdk

Setuptools

Install via Setuptools.

python setup.py install --user

(or sudo python setup.py install to install the package for all users)

Then import the package:

import memas_sdk

Getting Started

Please follow the installation procedure and then run the following:

import time
import memas_sdk
from pprint import pprint
from memas_sdk.apis.tags import cp_api
from memas_sdk.model.corpus_type import CorpusType
from memas_sdk.model.namespace_does_not_exist_error import NamespaceDoesNotExistError
from memas_sdk.model.namespace_exist_error import NamespaceExistError
from memas_sdk.model.namespace_illegal_name_error import NamespaceIllegalNameError
# Defining the host is optional and defaults to http://localhost
# See configuration.py for a list of all supported configuration parameters.
configuration = memas_sdk.Configuration(
    host = "http://localhost"
)


# Enter a context with an instance of the API client
with memas_sdk.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = cp_api.CpApi(api_client)
    any_type = dict(
        namespace_pathname="memas.chatbot.persona1",
        corpus_pathname="memas:wikipedia",
        corpus_type=CorpusType("knowledge"),
    ) # anyType | 

    try:
        # Create corpus
        api_response = api_instance.create_corpus(any_type)
        pprint(api_response)
    except memas_sdk.ApiException as e:
        print("Exception when calling CpApi->create_corpus: %s\n" % e)

Documentation for API Endpoints

All URIs are relative to http://localhost

Class Method HTTP request Description
CpApi create_corpus post /cp/corpus Create corpus
CpApi create_user post /cp/user Create user
CpApi delete_corpus delete /cp/corpus Delete corpus
CpApi delete_user delete /cp/user Delete user
DpApi memorize post /dp/memorize Memorize information
DpApi recall get /dp/recall Recalls information

Documentation For Models

Documentation For Authorization

Endpoints do not require authorization.

Author

max.yu@memas.ai

Notes for Large OpenAPI documents

If the OpenAPI document is large, imports in memas_sdk.apis and memas_sdk.models may fail with a RecursionError indicating the maximum recursion limit has been exceeded. In that case, there are a couple of solutions:

Solution 1: Use specific imports for apis and models like:

  • from memas_sdk.apis.default_api import DefaultApi
  • from memas_sdk.model.pet import Pet

Solution 1: Before importing the package, adjust the maximum recursion limit as shown below:

import sys
sys.setrecursionlimit(1500)
import memas_sdk
from memas_sdk.apis import *
from memas_sdk.models import *