Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs #19

Merged
merged 7 commits into from
Apr 1, 2024
Merged

Docs #19

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ update-all:
poetry export --without-hashes --with dev -E all -f requirements.txt --output requirements-all.txt && \
poetry export --without-hashes --with test -E server -E google -E groq -E huggingface_cpu -f requirements.txt --output requirements-test.txt

docs:
mkdocs serve

pytest:
python -m pytest --cov=languru --cov-config=.coveragerc --cov-report=xml:coverage.xml

Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ The general-purpose LLM app stacks deploy AI services quickly and (stupidly) sim
[![PytestCI](https://github.com/dockhardman/languru/actions/workflows/python-pytest.yml/badge.svg)](https://github.com/dockhardman/languru/actions/workflows/python-pytest.yml)
[![codecov](https://codecov.io/gh/dockhardman/languru/graph/badge.svg?token=OFX6C8Z31C)](https://codecov.io/gh/dockhardman/languru)

Documentation: [Github Pages](https://dockhardman.github.io/languru/)

## Getting Started

Install Languru:
Expand All @@ -20,11 +22,10 @@ pip install languru[all] # Or install all dependencies (include `torch`, `trans
Run llm action server:

```shell
echo OPENAI_API_KEY=<YOUR_API_KEY> >>.env # Replace <YOUR_API_KEY> with your key
languru llm run
OPENAI_API_KEY=$OPENAI_API_KEY languru llm run # Remember set OPENAI_API_KEY before you run.
```

Query llm service.
Query LLM service, which is fully compatible with OpenAI APIs.

```python
from openai import OpenAI
Expand Down
5 changes: 5 additions & 0 deletions docs/concepts/action.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
weight: 100
---

# Action
5 changes: 5 additions & 0 deletions docs/concepts/llm.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
weight: 200
---

# LLM
51 changes: 39 additions & 12 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,44 @@
# Welcome to MkDocs
# Welcome to Languru

For full documentation visit [mkdocs.org](https://www.mkdocs.org).
The general-purpose LLM app stacks deploy AI services quickly and (stupidly) simply.

## Commands
[![image](https://img.shields.io/pypi/v/languru.svg)](https://pypi.python.org/pypi/languru)
[![image](https://img.shields.io/pypi/l/languru.svg)](https://pypi.python.org/pypi/languru)
[![image](https://img.shields.io/pypi/pyversions/languru.svg)](https://pypi.python.org/pypi/languru)
[![PytestCI](https://github.com/dockhardman/languru/actions/workflows/python-pytest.yml/badge.svg)](https://github.com/dockhardman/languru/actions/workflows/python-pytest.yml)
[![codecov](https://codecov.io/gh/dockhardman/languru/graph/badge.svg?token=OFX6C8Z31C)](https://codecov.io/gh/dockhardman/languru)

* `mkdocs new [dir-name]` - Create a new project.
* `mkdocs serve` - Start the live-reloading docs server.
* `mkdocs build` - Build the documentation site.
* `mkdocs -h` - Print help message and exit.
Source Code: [Languru on Github](https://github.com/dockhardman/languru)

## Project layout
## Getting Started

mkdocs.yml # The configuration file.
docs/
index.md # The documentation homepage.
... # Other markdown pages, images and other files.
Install Languru:

```shell
pip install languru[server]
pip install languru[all] # Or install all dependencies (include `torch`, `transformers`, ...)
```

Run llm action server:

```shell
OPENAI_API_KEY=$OPENAI_API_KEY languru llm run # Remember set OPENAI_API_KEY before you run.
```

Query LLM service, which is fully compatible with OpenAI APIs.

```python
from openai import OpenAI

client = OpenAI(base_url="http://localhost:8682/v1")
res = client.chat.completions.create(
model="gpt-3.5-turbo",
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Hello!"},
],
)
for choice in res.choices:
print(f"{choice.message.role}: {choice.message.content}")
# assistant: Hello! How can I assist you today?
```
42 changes: 42 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,48 @@ theme:
repo: fontawesome/brands/github
edit: material/pencil
view: material/eye
palette:
- primary: lime
- accent: lime
- scheme: default
toggle:
icon: material/brightness-7
name: Switch to dark mode
- scheme: slate
toggle:
icon: material/brightness-4
name: Switch to light mode
features:
- content.action.edit
- content.code.annotate
- content.code.copy
- content.code.select
- navigation.path
- navigation.tabs
- navigation.top
- toc.follow
markdown_extensions:
- abbr
- admonition
- attr_list
- def_list
- footnotes
- md_in_html
- tables
- pymdownx.arithmatex:
generic: true
- pymdownx.betterem
- pymdownx.caret
- pymdownx.mark
- pymdownx.tilde
- pymdownx.critic:
mode: view
- pymdownx.details
- pymdownx.superfences:
custom_fences:
- name: mermaid
class: mermaid
format: !!python/name:pymdownx.superfences.fence_code_format
plugins:
- git-authors
- mkdocs-nav-weight
Expand Down
Loading