Skip to main content

A mkdocs plugin to generage summary with the help of AI.

Project description

mkdocs-ai-summary

PyPI - Version PyPI - Implementation PyPI - Python Version

Generage an ai-summary and insert into page content:

Live Demo

Minimal demo(raw mkdocs): AIboy996/mkdocs-ai-summary-minimal-example

Another demo(mkdocs-material theme): AIboy996/mkdocs-ai-summary

Real world demo(my homepage): yangzhang.site

I wrote these codes for my blog site at first. Now it's open for anyone who may need AI to summarize his words.

Installation

You should install the package with pip:

pip install mkdocs-ai-summary[chatgpt]
# this will install `openai` additionally

or

pip install mkdocs-ai-summary[tongyi]
# this will install `dashscope` additionally

[!WARNING]

Only support ChatGPT and tongyi ai for now.

To use ChatGPT(default), you should set a Environmental Variable for api key:

export OPENAI_API_KEY='sk-xxxxxxx'

how to get an OPENAI_API_KEY?

To use tongyi ai, you should set a Environmental Variable for api key:

export DASHSCOPE_API_KEY='sk-xxxxxxx'

how to get an DASHSCOPE_API_KEY?

[!TIP]

Furthermore you can include the ai-summary.css as extra_css in the config file.

This is optional, and iff you are using mkdocs-material theme this can work.

Configuration

All parameters:

name type default value note
api str chatgpt only support chatgpt or tongyi
model str gpt-3.5-turbo -
ignore_code bool true ignore code block in markdown
cache bool true -
cache_dir str "./" -
prompt str "Please help me summarize the following content into an abstract within 200 words: " -

Example Configuration For ChatGPT Summary

Setup mkdocs.yml like this:

site_name: mkdocs-ai-summary
theme:
  name: material

plugins:
  # use default config
  - ai-summary
  - tags

markdown_extensions:
  - admonition
  - pymdownx.details
  - pymdownx.superfences
  - pymdownx.tabbed:
      alternate_style: true 
extra_css:
  - ai-summary.css

Then for the page you want an ai-summary, just add a meta tag:

---
include:
- ai-summary
---

# title

hello ai summary.

Example Configuration For tongyi ai Summary

or you can use tongyi ai by setting:

plugins:
  - ai-summary:
      api: "tongyi"
      model: "qwen-turbo"
      ignore_code: true
      cache: true
      cache_dir: "./"
      prompt: "Please help me summarize the following content into an abstract within 200 words: "

Setup ai-summary for specific page

You can also setup ai summary for each page separately:

---
include:
- ai-summary
ai-summary-config:
    api: "tongyi"
    model: "qwen-turbo"
    prompt: "Say anything, 200 words."
---

# title

hello ai summary.

all config options are available. Page configuration will override unified configuration.

About Cache

Don't worry about duplicate api calls, we've made the cache function so that if you've done an ai-summary before and the content hasn't changed it will use the cache.

Enjoy it.

SPECIAL THANKS TO

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mkdocs_ai_summary-0.2.6.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mkdocs_ai_summary-0.2.6-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

Details for the file mkdocs_ai_summary-0.2.6.tar.gz.

File metadata

  • Download URL: mkdocs_ai_summary-0.2.6.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.10.15

File hashes

Hashes for mkdocs_ai_summary-0.2.6.tar.gz
Algorithm Hash digest
SHA256 1a016a88a4932ee647f30149a7c9d0da507e4584fc25205154f857a9ba9c4ca5
MD5 1269dcb3cd7f34ad2093b7199a2286aa
BLAKE2b-256 1c2c35b29d7af15b4a770f8db7b778d311479232995c2509e842757c66cfa9f7

See more details on using hashes here.

File details

Details for the file mkdocs_ai_summary-0.2.6-py3-none-any.whl.

File metadata

File hashes

Hashes for mkdocs_ai_summary-0.2.6-py3-none-any.whl
Algorithm Hash digest
SHA256 87e1c7c5ab0646c96114b0d7226bcdd8be03563e6e1a983596276988a30caa7d
MD5 d6fd6f728d0d475fa26d5f29349a34e1
BLAKE2b-256 90c273ec772dd1caee8437005c007a53823714d52940910939ec5292a2410477

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page