Gramex 1.92 release notes

Gramex 1.92 adds ChatGPTHandler, OTP custom keys and Excel Hyperlink support.

ChatGPTHandler

ChatGPTHandler provides interface to OpenAI’s chat API.

url:
  chatgpthandler:
    pattern: /$YAMLURL/chat
    handler: ChatGPTHandler
    kwargs:
      key: sz-....

Replace the key with your OpenAI API key

This opens a WebSocket connection to /chat. You can read more about how to send messages to it here

OTP custom keys

OTPs and API keys store a user JSON object. You can pass additional keys to this object using the columns configuration.

storelocations:
  otp:
    columns:
      role: TEXT
      group: TEXT

You can populate these columns using keyword arguments to handler.otp() and handler.api_key(). More details here

gramex.cache.open() now extracts hyperlinks from an Excel column. For example, this Excel file city-sales.xlsx has a “City” column with hyperlinks.

Country City Sales
Italy Rome 10
Norway Oslo 20
UK London 30
France Paris 40

Using gramex.cache.open('city-sales.xlsx', links=True) will read it as a DataFrame with a new City_links column with the hyperlinks.

Country City Sales City_link
Italy Rome 10 https://en.wikipedia.org/wiki/Rome
Norway Oslo 20 https://en.wikipedia.org/wiki/Oslo
UK London 30 https://en.wikipedia.org/wiki/London
France Paris 40 https://en.wikipedia.org/wiki/Paris

You can specify column names to extract from explicitly as a dictionary. For example:

gramex.cache.open('city-sales.xlsx', links={
   'City': 'city_url',
   'Country': 'country_url'
})

This extracts the hyperlink from City into city_url and Country into country_url. Empty hyperlinks are stored as NaN.

Backward incompatible changes

Bug fixes

Backward compatibility & security

Gramex 1.92 is backward compatible with previous releases unless the release notes say otherwise. We ensure this with automated tests.

Every Gramex release is tested for security vulnerabilities using the following tools.

  1. Bandit tests for back-end Python vulnerabilities. See Bandit results
  2. npm-audit tests for front-end JavaScript vulnerabilities. See npm-audit results
  3. Snyk for front-end and back-end vulnerabilities. See Synk results
  4. ClamAV for anti-virus scans. See ClamAV results
  5. Trivy for container scans. See Trivy results

Statistics

The Gramex code base has:

How to install

See the Gramex installation and upgrade instructions.