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 for the page:

Minimal demo: aiboy996.github.io/mkdocs-ai-summary

Live demo(my homepage): yangzhang.site

Installation

You should install the package with pip:

pip install mkdocs-ai-summary[chatgpt]

or

pip install mkdocs-ai-summary[tongyi]

⚠️⚠️⚠️⚠️

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?

[optional] Then you can include the ai-summary.css(optional, this is for the custom ai summary admonition style) in the config file as below:

Configuration

Options can be set

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: " -

For ChatGPT Summary

Setup mkdocs.yml like this:

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

plugins:
  - ai-summary:
      api: "chatgpt"
      model: "gpt-3.5-turbo"
      ignore_code: true 
      cache: true
      cache_dir: "./"
      prompt: "Please help me summarize the following content into an abstract within 200 words: "
  - 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.

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: "帮我把下面的内容总结为200字以内的摘要:"
---

# 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.

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.3.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

mkdocs_ai_summary-0.2.3-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: mkdocs_ai_summary-0.2.3.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.10.14

File hashes

Hashes for mkdocs_ai_summary-0.2.3.tar.gz
Algorithm Hash digest
SHA256 d358730c655d31a1f0deafa0b0ac6585bf08ac06669d7dc57b23fe515261e24d
MD5 6597940d866e9b98d90a707db880fa11
BLAKE2b-256 42c71933068e6d0a788f1c3a8ff4872ba56bf2ead4924d87d418ce4f5153c0e8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mkdocs_ai_summary-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 d7b229fe6a9e6ce14a1258ca307385e2f6c3b37327b41dc3ac8a5772aed91dbb
MD5 f9e73b62a68fe89a31737218d7f7d025
BLAKE2b-256 cbd2a84af2dfc9b19030ed6bd38cfc0686b2a17a72564cb7eb9551198c190bda

See more details on using hashes here.

Supported by

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