neverminedio/molecule_service

By neverminedio

Updated over 1 year ago

Image

125

Nevermined Molecule Summarizer Service

Introduction

This service implementation is part of the Molecule Summarizer by Nevermined.
The Summarizer takes a reasearch paper focused on DeSci env, and generated a summary, using OpenAI API, that includes key information about molecules and proteins. This service handles the clients request of new jobs and integrates Nevermined, so all the input data, and the sumary result, are Nevermined Assets.

There are 3 endpoints:

  • summarizer/v1/request: endpoint to request a new summary of a document contained in a Nevermined Asset. Returns a jobId
  • summarizer/v1/status: endpoint to check the status of a jobId
  • summarizer/v1/get_result: endpoint to get the Did and the url of the new Asset published in Nevermined that contains the summary generated.

More information about the endpoints in summarizer/v1/docs

It's important to remark that this service does not interact with OpenAI in anyway, and it's not responsible to create the summary. Only manage the job request and the integration with Nevermined. There is another piece in the Molecule Summarizer architecture, fed by the jobs created here, that create this summaries using ChatGPT.

First-time setup

Pre-requisites
  • Make sure you've installed docker
  • Make sure you've installed NodeJS version. You can see the version in the nvmrc file
  • You can also install nvm in order to switch between different node versions
  • Set yarn to install internal packages
Install dependencies

Install all necessary dependencies via:

yarn
Build and lint

You can build the project running

yarn build

And check the linter

yarn lint
Copy profile configuration

Copy the local profile configuration via:

yarn setup:dev

This will leave you with a local.js file within the config folder that will be used as the profile configuration.

Environment variables

#### Nevermined Integration

  • WEB3_PROVIDER_URL. Web3Provider
  • NODE_URI. Url of the node component
  • MARKETPLACE_URI. Url of the marketplace-api component
  • TOKEN_ADDRESS. Address of the token used in the network where Nevermined is deployed
  • NODE_ADDRESS. Address used by the node component
  • ARTIFACTS_FOLDER. Path to a folder that contains Nevermined's smart contracts artifacts
  • CIRCUITS_FOLDER. Path to a folder that contains Nevermined's circuits
  • PROVIDER_KEYFILE. Path to the keyfile of the Provider Account
  • PROVIDER_PASSWORD. Password of the Provider Account
  • RSA_PRIVKEY_FILE. Path to RSA private key
  • RSA_PUBKEY_FILE. Path to RSA public key

### Service configuration

  • ACCESS_TOKEN_SECRET. Token user needs to include in Authorization Header

  • DOWNLOAD_PATH. Path to a folder where the service wil download the files contained in the input assets

  • JOB_INDEX_NAME. Name of the index to store all the job request. Default value is molecule_job

  • SUMMARY_INDEX_NAME. Name of the index to store the output summaries. Default value is molecule_summary

  • ELASTIC_CLOUD_ID. If you are using an Elastic Cloud account

  • ELASTIC_API_KEY. If you are using Elastic Cloud, an apiKey to authenticate

  • ELASTIC_NODE. Host of an Elastic 8 instance. Not necessary if you are using Elastic Cloud

  • ELASTIC_CERT_PATH. Path to a certificate to use in Elastic 8 connection.

  • ELASTIC_USER. If basic authentication is enabled

  • ELASTIC_PASSWORD. If basic authentication is enabled

  • GCLOUD_BUCKET.Name of a GCloud Storage Bocket

  • GOOGLE_APPLICATION_CREDENTIALS. Path to a credentials file for Google Cloud

  • NVM_APP_DOMAIN. Domain of the Nevermined App where the user can visualice the details of the DDO with the result. Example: 'https://goerli.nevermined.app'

  • NVM_APP_DATASET_URL. Dataset url in Nevermined App. Default to '/en/dataset'

  • SUMMARY_COVER_IMAGE_URL. Url of an image the service will use as cover image for the new asset.

Docker Pull Command

docker pull neverminedio/molecule_service