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

⬆️v0.2 - new features + docs #16

Merged
merged 457 commits into from
Feb 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
457 commits
Select commit Hold shift + click to select a range
6ab32bf
🔧 Disable default LLM setting
shroominic Jan 25, 2024
540944f
🔄 Refactor image import logic
shroominic Jan 25, 2024
16ce8bf
🔼 Bump version to alpha.4
shroominic Jan 25, 2024
e2ec000
📦 Add Image input type
shroominic Jan 25, 2024
abe3905
✨ Refactor type handling, parsers
shroominic Jan 25, 2024
fd0c848
🔧 Refactor type handling logic
shroominic Jan 25, 2024
9a3431d
📸 Update image handling
shroominic Jan 25, 2024
ad1746c
🔧 Update output_types annotation
shroominic Jan 25, 2024
1348068
✨ Add retry logic parsers
shroominic Jan 25, 2024
aa41e50
✨ Refactor parser selection logic
shroominic Jan 25, 2024
801d54a
🔄 Update output type handling
shroominic Jan 25, 2024
491abfd
🔧 Adjust output type tuples
shroominic Jan 25, 2024
aa9ec6c
✨ Add type hinting
shroominic Jan 25, 2024
7ad094c
🖼️ Support image inputs.
shroominic Jan 25, 2024
e1a8a1b
✨ Add Image class support
shroominic Jan 25, 2024
8bdc31f
🔄 Refactor image utility functions
shroominic Jan 25, 2024
c9bd424
🔧 Change list to tuple
shroominic Jan 25, 2024
a424127
🔧 Adjust answer parameter type
shroominic Jan 25, 2024
dc9a8de
🔄 Refactor image analysis test
shroominic Jan 25, 2024
d31455d
🔄 Update image import path
shroominic Jan 25, 2024
276cb33
🔧 Remove console_stream setting
shroominic Jan 25, 2024
4aabde8
🔧 fix pre-commit issues
shroominic Jan 25, 2024
44957aa
🔧 fix empty system message
shroominic Jan 25, 2024
3d16c8b
Documentation
luckysanpedro Jan 25, 2024
876fab7
merge
luckysanpedro Jan 25, 2024
1fbbb49
Merge branch 'codebase-restructure' of https://github.com/shroominic/…
luckysanpedro Jan 25, 2024
088bc4d
📝 Update ChatModel documentation
shroominic Jan 26, 2024
1d0228a
🔥 Simplify print statement
shroominic Jan 26, 2024
6900b30
🔧 Adjust output_types syntax
shroominic Jan 26, 2024
68f11d4
✨ Add Jinja example script
shroominic Jan 26, 2024
0445ee3
🔥 Remove unused attribute
shroominic Jan 26, 2024
cb8ac10
✨ Add sentiment analysis example
shroominic Jan 26, 2024
19bcd89
✨ Add primitive types example
shroominic Jan 26, 2024
8443df5
🔧 Remove unused dependencies
shroominic Jan 26, 2024
a6f263e
🔧 Update development dependencies
shroominic Jan 26, 2024
364b419
🔄 Update roadmap priorities
shroominic Jan 26, 2024
80999cf
🔧 Refactor compiler types, parsers
shroominic Jan 26, 2024
7a56513
🔧 Update type annotations
shroominic Jan 26, 2024
c9631f7
✨ Add Jinja2 template support
shroominic Jan 26, 2024
9866c4c
✨ Add local models path setting
shroominic Jan 26, 2024
59c6b63
🔀 Update import path
shroominic Jan 26, 2024
2f91513
✨ Add GGUF model support
shroominic Jan 26, 2024
86f2d2f
✨ Add patches module init
shroominic Jan 26, 2024
bba4200
🦙 Add LlamaCPP model support
shroominic Jan 26, 2024
d7b4b5b
🚚 Rename ollama.py file
shroominic Jan 26, 2024
5a9192b
🧹 Clean import, adjust types
shroominic Jan 26, 2024
b832431
🔧 Adjust type annotations
shroominic Jan 26, 2024
abf48ed
✨ Add primitive types parser
shroominic Jan 26, 2024
e909509
✨ Refactor parser selection logic
shroominic Jan 26, 2024
cf73b40
🔥 Simplify Signature model
shroominic Jan 26, 2024
fe038c7
🔄 Update RouterModel output type
shroominic Jan 26, 2024
b192f3b
🔧 Update output_types typing
shroominic Jan 26, 2024
50580e3
🔧 Update type annotations
shroominic Jan 26, 2024
373212d
✨ Add jinja_test.py skeleton
shroominic Jan 26, 2024
f1826ee
✨ Add retry_validation_test.py
shroominic Jan 26, 2024
9994c3a
📝 Add router component tests
shroominic Jan 26, 2024
794681e
📝 Add streaming_test.py skeleton
shroominic Jan 26, 2024
7933964
✨ Add llamacpp tests
shroominic Jan 26, 2024
aa32996
🚚 Rename ollama_test.py
shroominic Jan 26, 2024
732f91d
🚚 Rename openai_test.py file
shroominic Jan 26, 2024
a7d52ad
🔍 Improve example test output
shroominic Jan 26, 2024
c140eff
🗑️ Remove llm_overrides.py file
shroominic Jan 26, 2024
ce79f1c
🗑️ Remove ollama_test.py file
shroominic Jan 26, 2024
6a97c59
🗑️ Remove openai_test.py file
shroominic Jan 26, 2024
473de97
🧪 fix tests
shroominic Jan 27, 2024
fd3905d
🔄 Update model reference
shroominic Jan 27, 2024
fd725ae
✨ Add roadmap items
shroominic Jan 27, 2024
121a011
📝 Add image handling to Ollama
shroominic Jan 27, 2024
0938096
✨ Add list parsing support
shroominic Jan 27, 2024
8e70866
🔧 Update type annotations
shroominic Jan 27, 2024
e24dc02
⬆️ v0.2.0-alpha.5
shroominic Jan 27, 2024
6716edd
🔧 fix langsmith run names
shroominic Jan 27, 2024
cd58bfb
📝 custom model display example
shroominic Jan 27, 2024
a5b7014
🔧 fix code check
shroominic Jan 27, 2024
60edca6
📝 update todos
shroominic Jan 27, 2024
b39c827
🔖 todo
shroominic Jan 28, 2024
82aaf82
📝 Add CONTRIBUTING guidelines
shroominic Jan 28, 2024
1601577
✨ Add insert examples doc
shroominic Jan 28, 2024
075ffa2
🗑️ Remove obsolete todo.md
shroominic Jan 28, 2024
c95a473
🔀 Reorder roadmap tasks
shroominic Jan 28, 2024
74caf52
📝 Add async documentation guide
shroominic Jan 28, 2024
a2bfea0
📝 Add codebase scaling documentation
shroominic Jan 28, 2024
b38d50b
📝 Add runnables documentation section
shroominic Jan 28, 2024
b1f2a58
✨ Add signature documentation
shroominic Jan 28, 2024
b096556
📄 Add stream-parsing documentation
shroominic Jan 28, 2024
aff7a06
📝 Add codebase structure documentation
shroominic Jan 28, 2024
f39bb4a
📝 Add dev setup instructions
shroominic Jan 28, 2024
348f65c
📝 Add initial TODOs markdown
shroominic Jan 28, 2024
30f9e55
🗑️ Remove async.md file
shroominic Jan 28, 2024
a51b745
✨ Add chain documentation skeleton
shroominic Jan 28, 2024
8170d09
📝 Document error handling approach
shroominic Jan 28, 2024
3a67095
✨ Add input concepts documentation
shroominic Jan 28, 2024
e4cd9f5
📝 Add LangChain documentation
shroominic Jan 28, 2024
a0e37d2
📝 Add local models documentation
shroominic Jan 28, 2024
0f45066
🗑️ Remove models.md file
shroominic Jan 28, 2024
2e35546
📝 Add parser documentation markdown
shroominic Jan 28, 2024
367fab8
🗑️ Remove prompt.md file
shroominic Jan 28, 2024
6636399
📝 Add prompting concepts doc
shroominic Jan 28, 2024
7b56394
📚 Add streaming documentation
shroominic Jan 28, 2024
2a5d5c6
🗑️ Remove obsolete types documentation
shroominic Jan 28, 2024
ecac693
📝 Add unions.md documentation
shroominic Jan 28, 2024
623114e
📝 Add vision models documentation
shroominic Jan 28, 2024
656cdf0
🔧 config
shroominic Jan 28, 2024
36a7a3e
📝 Add models documentation
shroominic Jan 28, 2024
164bc0a
✨ Add usage documentation
shroominic Jan 28, 2024
070f0af
📝 fix eof
shroominic Jan 28, 2024
fe29b54
Merge pull request #15 from luckysanpedro/codebase-restructure
shroominic Jan 28, 2024
208b0a9
🗑️ Remove examples.md file
shroominic Jan 28, 2024
32a08e2
✨ Add installation instructions
shroominic Jan 28, 2024
9676d59
📚 Update documentation and examples
shroominic Jan 28, 2024
e29ad5a
Merge remote-tracking branch 'refs/remotes/origin/v0.2' into v0.2
shroominic Jan 28, 2024
9e49c5d
🔄 Update README formatting and features
shroominic Jan 28, 2024
eb01d76
📘 Add custom parser documentation
shroominic Jan 28, 2024
13d5a0b
✨ Add customization documentation
shroominic Jan 28, 2024
b28e49d
📝 Update changelog structure.
shroominic Jan 28, 2024
4cd960d
✍️ Add TODO for rewrite
shroominic Jan 28, 2024
969401b
📝 Rename pydantic.md file
shroominic Jan 28, 2024
476798f
📜 Add Code of Conduct
shroominic Jan 28, 2024
fbfeda9
📝 Add contributors documentation
shroominic Jan 28, 2024
907e063
📄 Add MIT License doc
shroominic Jan 28, 2024
8e43d11
📝 Initialize roadmap documentation tasks
shroominic Jan 28, 2024
c69bedb
🔒 Add security guidelines document
shroominic Jan 28, 2024
075a5bf
🗑️ Remove obsolete todo.md file
shroominic Jan 28, 2024
c339130
📝 Renamed chat documentation file
shroominic Jan 28, 2024
623fd27
🔀 Rename dynamic_router documentation
shroominic Jan 28, 2024
a6e9b29
📝 Rename enums documentation file
shroominic Jan 28, 2024
08350e1
📝 Rename error_output documentation
shroominic Jan 28, 2024
54dd0b7
📝 Rename literals documentation file
shroominic Jan 28, 2024
00c0856
✨ Add settings_override example
shroominic Jan 28, 2024
eb3db01
📝 Update installation instructions markdown
shroominic Jan 28, 2024
d6e7c30
📝 Update installation command, links
shroominic Jan 28, 2024
0108e0f
✨ Add AzureChatOpenAI example
shroominic Jan 28, 2024
a5dbdb7
📦 Update installation instructions
shroominic Jan 28, 2024
02796c1
🗑️ Removed smart_question.py file
shroominic Jan 28, 2024
c1b2621
📚 Update documentation structure
shroominic Jan 28, 2024
f4797d2
🔀 Renamed primitive_type.py file
shroominic Jan 28, 2024
c0a4099
🗑️ Remove chat.md example
shroominic Jan 28, 2024
a547e1e
🗑️ Remove dynamic_router.md file
shroominic Jan 28, 2024
c6ed6d0
🗑️ Remove enums.md file
shroominic Jan 28, 2024
492715d
🗑️ Remove error_output.md file
shroominic Jan 28, 2024
34072cc
🗑️ Remove literals.md file
shroominic Jan 28, 2024
ab28541
🗑️ Remove obsolete examples file
shroominic Jan 28, 2024
e32aed3
🗑️ Remove obsolete parsers.py file
shroominic Jan 28, 2024
cbdd2d5
🗑️ Remove obsolete primitive_type.py
shroominic Jan 28, 2024
859caf6
📚 Update installation instructions
shroominic Jan 28, 2024
5251bda
📚 Update documentation structure.
shroominic Jan 28, 2024
7d95096
📝 Update chat.md formatting
shroominic Jan 29, 2024
6a533f2
📝 Add newline to document
shroominic Jan 29, 2024
9a330fd
📝 Correct markdown formatting
shroominic Jan 29, 2024
7271a15
📝 Update markdown formatting
shroominic Jan 29, 2024
2559dc6
📝 Update markdown formatting
shroominic Jan 29, 2024
56c41f1
🔧 Remove unnecessary prompt symbol
shroominic Jan 29, 2024
35680ad
📝 Update integration instructions
shroominic Jan 29, 2024
f37fcae
🔧 Update pre-commit hooks
shroominic Jan 29, 2024
314ad07
🗑️ Removed .python-version file
shroominic Jan 29, 2024
4cfdc6b
✨ Update roadmap checklist
shroominic Jan 29, 2024
31bdc2e
🎨 Add newline to custom.css
shroominic Jan 29, 2024
b4e5ea8
🎨 Add newline to termynal.css
shroominic Jan 29, 2024
8613323
🧹 Remove trailing whitespace
shroominic Jan 29, 2024
29c49b9
🔧 Remove extra whitespace markdown
shroominic Jan 29, 2024
e1ef9f6
🔥 Remove trailing whitespace
shroominic Jan 29, 2024
475780e
🧹 Remove extra whitespace
shroominic Jan 29, 2024
ffb6d8e
🧹 Clean trailing whitespace
shroominic Jan 29, 2024
5e1152b
✨ Restore main function call
shroominic Jan 29, 2024
53b2545
🔧 Add newline to termynal.js
shroominic Jan 29, 2024
a3385bb
🧹 Standardize whitespace in mkdocs.yml
shroominic Jan 29, 2024
709fc08
copy button and examples for .md
luckysanpedro Jan 29, 2024
82a5535
🔀 Merge remote-tracking branch 'luckysanpedro/examples_and_copy_butto…
shroominic Jan 29, 2024
b67f691
🧼 prettier format
shroominic Jan 29, 2024
c00b031
📝 Correct code block formatting
shroominic Jan 30, 2024
3a1d4e7
📚 Update mkdocs navigation structure
shroominic Jan 30, 2024
e58b495
📝 markdownlint-disable
shroominic Jan 30, 2024
992e4df
✨ Update chain documentation details
shroominic Jan 30, 2024
c311f6f
✨ Add Error handling example
shroominic Jan 30, 2024
8d0f6bb
📝 Update input handling documentation
shroominic Jan 30, 2024
f995e3b
📝 Update concepts documentation
shroominic Jan 30, 2024
86c2692
📝 Rename demos.md file
shroominic Jan 30, 2024
0288f5a
📚 Update navigation and links
shroominic Jan 30, 2024
8dfa095
📚 Update LangChain documentation
shroominic Jan 30, 2024
b116b83
📚 Add LlamaCPP and grammars info
shroominic Jan 30, 2024
8ecbe3d
🗑️ Remove introduction.md file
shroominic Jan 30, 2024
b295f8a
📝 update todos
shroominic Jan 31, 2024
b1ed7f9
✨ Add async documentation TODOs
shroominic Feb 1, 2024
a0b7ac1
✍️ Add TODOs for documentation
shroominic Feb 1, 2024
02524ed
✨ Add TODO placeholders
shroominic Feb 1, 2024
68d9da5
✨ Add TODO placeholders
shroominic Feb 1, 2024
e28a3a1
✍️ Add TODO placeholders in runnables.md
shroominic Feb 1, 2024
555bc36
✨ Add TODO placeholders
shroominic Feb 1, 2024
6f12e21
📘 Add stream parsing docs
shroominic Feb 1, 2024
ac21ea7
📝 Update chain documentation markdown
shroominic Feb 1, 2024
b7c1cb4
🧹 Remove extra whitespace
shroominic Feb 1, 2024
057259e
📝 Add images section placeholder
shroominic Feb 1, 2024
79b8237
📚 Update langchain documentation details
shroominic Feb 1, 2024
41b38c6
📝 Update parser documentation details
shroominic Feb 1, 2024
21500dd
📝 Update prompting documentation
shroominic Feb 1, 2024
30d4800
📚 Add Pydantic documentation details
shroominic Feb 1, 2024
5220cda
📚 Expand streaming documentation
shroominic Feb 1, 2024
4edf9d8
📚 Update unions.md documentation
shroominic Feb 1, 2024
d791f16
🖼️ Update vision models documentation
shroominic Feb 1, 2024
afd44fc
🗑️ Remove code-of-conduct.md
shroominic Feb 1, 2024
d3cbf17
📝 Add codebase structure placeholder
shroominic Feb 1, 2024
b89fa53
📝 Simplify contributors section
shroominic Feb 1, 2024
52d21c8
📝 Update roadmap tasks
shroominic Feb 1, 2024
8aa4166
🔒 Add security reporting instructions
shroominic Feb 1, 2024
2a28b06
🗑️ Remove chat feature documentation
shroominic Feb 1, 2024
6536786
📝 Update dynamic_router.md formatting
shroominic Feb 1, 2024
828ae8b
📝 Update enums.md example
shroominic Feb 1, 2024
03d9d85
📝 Update error_output.md formatting
shroominic Feb 1, 2024
eb0b4de
📝 Update literals documentation
shroominic Feb 1, 2024
868efc1
📝 Update ollama example usage
shroominic Feb 1, 2024
4743d63
🧹 Simplify sum_fruits example
shroominic Feb 1, 2024
b3baf52
🔁 Rename retry parsing documentation
shroominic Feb 1, 2024
0922119
🚚 Refactor main execution block
shroominic Feb 1, 2024
0d67e13
📝 Improve code formatting
shroominic Feb 1, 2024
8f11284
📝 Update example output, refactor
shroominic Feb 1, 2024
aecec53
🧹 Clean up comments demos.md
shroominic Feb 1, 2024
eb40656
✍️ Update poem generation docs
shroominic Feb 1, 2024
24d5789
🔄 Update model identifier
shroominic Feb 1, 2024
e1fd83a
🔄 Update LLM setting
shroominic Feb 1, 2024
ab9f294
🍎 Simplify sum_fruits return type
shroominic Feb 1, 2024
8d2adeb
📝 Reorganize navigation structure
shroominic Feb 1, 2024
5812efc
🧹 Simplify pyproject.toml layout
shroominic Feb 1, 2024
bc206e7
📦 Update development dependencies
shroominic Feb 1, 2024
f3e9e90
🔒 Update requirements.lock dependencies
shroominic Feb 1, 2024
8808a47
✨ Add runnable decorator
shroominic Feb 1, 2024
a826fbc
✏️ Rename Pydantic model
shroominic Feb 1, 2024
b8b2bb2
🗑️ Remove pydantic_validation.md file
shroominic Feb 1, 2024
a12d71d
✨ Add async programming guide
shroominic Feb 1, 2024
4bb13b8
🧹 Remove trailing whitespace
shroominic Feb 1, 2024
063fc44
🧹 Remove extraneous whitespace
shroominic Feb 1, 2024
cdcf813
🧹 Remove trailing whitespace
shroominic Feb 1, 2024
0314bdc
🧹 Remove trailing whitespace
shroominic Feb 1, 2024
75eb081
📝 Add llamacpp usage example
shroominic Feb 1, 2024
b015535
🧹 Remove redundant whitespace
shroominic Feb 1, 2024
630eb4a
📝 Update whitespace consistency
shroominic Feb 1, 2024
45b676c
🧹 Remove extra whitespaces
shroominic Feb 1, 2024
242329e
🔤 Remove trailing whitespace
shroominic Feb 1, 2024
807fbed
📝 Remove extra whitespace
shroominic Feb 1, 2024
83a865c
🧹 Remove extra whitespace
shroominic Feb 2, 2024
38dd45f
🔧 Remove LLM setting, add assert
shroominic Feb 2, 2024
397e29f
✅ Add type assertions
shroominic Feb 2, 2024
a4da047
🗑️ Remove dynamic_model_generation.py
shroominic Feb 2, 2024
70df0b1
🔄 Update model reference
shroominic Feb 2, 2024
3eb7da8
📥 Improve model download process
shroominic Feb 2, 2024
5e1f2f4
🔧 Update Python versions, indentation
shroominic Feb 2, 2024
00d80c0
🔧 Ignore .python-version file
shroominic Feb 2, 2024
ddf190a
🔒 Update dependency versions
shroominic Feb 2, 2024
c2693c7
🔒 Update dependencies versions
shroominic Feb 2, 2024
4c7d534
⬆️ v0.2.0
shroominic Feb 2, 2024
a81e9af
Merge branch 'main' into v0.2
shroominic Feb 2, 2024
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
32 changes: 16 additions & 16 deletions .github/workflows/code-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,21 @@ jobs:
pre-commit:
strategy:
matrix:
python-version: ['3.10', '3.11', '3.12']
python-version: ["3.10", "3.11"]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: eifinger/setup-rye@v1
with:
enable-cache: true
cache-prefix: 'venv-funcchain'
- name: pin version
run: rye pin ${{ matrix.python-version }}
- name: Sync rye
run: rye sync
- name: Run pre-commit
run: rye run pre-commit run --all-files
- name: Run tests
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
run: rye run pytest -m "not skip_on_actions"
- uses: actions/checkout@v2
- uses: eifinger/setup-rye@v1
with:
enable-cache: true
cache-prefix: "venv-funcchain"
- name: pin version
run: rye pin ${{ matrix.python-version }}
- name: Sync rye
run: rye sync
- name: Run pre-commit
run: rye run pre-commit run --all-files
- name: Run tests
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
run: rye run pytest -m "not skip_on_actions"
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -165,3 +165,4 @@ cython_debug/

vscext
.models
.python-version
33 changes: 12 additions & 21 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,23 +1,14 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: end-of-file-fixer
- id: trailing-whitespace

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.7.1
hooks:
- id: mypy
args: [--ignore-missing-imports, --follow-imports=skip]
additional_dependencies: [types-requests]

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.7
hooks:
- id: ruff
args: [ --fix ]
- id: ruff-format
types_or: [ python, pyi, jupyter ]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.7
hooks:
- id: ruff
args: [--fix]
- id: ruff-format
types_or: [python, pyi, jupyter]
1 change: 0 additions & 1 deletion .python-version

This file was deleted.

11 changes: 11 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Contributing

To contribute, clone the repo and run:

```bash
./dev_setup.sh
```

You should not run unstrusted scripts so ask ChatGPT to explain what the contents of this script do!

This will install and setup your development environment using [rye](https://rye-up.com) or pip.
27 changes: 16 additions & 11 deletions MODELS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

## LangChain Chat Models

You can set the `settings.llm` with any ChatModel the LangChain library.
You can set the `settings.llm` with any LangChain ChatModel.

```python
from langchain.chat_models import AzureChatOpenAI
from langchain_openai.chat_models import AzureChatOpenAI

settings.llm = AzureChatOpenAI(...)
```
Expand All @@ -16,23 +16,28 @@ You can also set the `settings.llm` with a string identifier of a ChatModel incl

### Schema

`<provider>/<name>:<optional_label>`
`<provider>/<model_name>:<optional_label>`

### Providers

- `openai`: OpenAI Chat Models
- `gguf`: Huggingface GGUF Models from TheBloke using LlamaCpp
- `local` | `thebloke` | `huggingface`: alias for `gguf`
- `llamacpp`: Run local models directly using llamacpp (alias: `thebloke`, `gguf`)
- `ollama`: Run local models through Ollama (wrapper for llamacpp)
- `azure`: Azure Chat Models
- `anthropic`: Anthropic Chat Models
- `google`: Google Chat Models

### Examples

- `openai/gpt-3.5-turbo`: Classic ChatGPT
- `gguf/deepseek-llm-7b-chat`: DeepSeek LLM 7B Chat
- `gguf/OpenHermes-2.5-7B`: OpenHermes 2.5
- `TheBloke/deepseek-llm-7B-chat-GGUF:Q3_K_M`: (eg thebloke huggingface identifier)
- `local/neural-chat-7B-v3-1`: Neural Chat 7B (local as alias for gguf)
- `openai/gpt-3.5-turbo`: ChatGPT Classic
- `openai/gpt-4-1106-preview`: GPT-4-Turbo
- `ollama/openchat`: OpenChat3.5-1210
- `ollama/openhermes2.5-mistral`: OpenHermes 2.5
- `llamacpp/openchat-3.5-1210`: OpenChat3.5-1210
- `TheBloke/Nous-Hermes-2-SOLAR-10.7B-GGUF`: alias for `llamacpp/...`
- `TheBloke/openchat-3.5-0106-GGUF:Q3_K_L`: with Q label

### additional notes

Checkout the file `src/funcchain/utils/model_defaults.py` for the code that parses the string identifier.
Checkout the file `src/funcchain/model/defaults.py` for the code that parses the string identifier.
Feel free to create a PR to add more models to the defaults. Or tell me how wrong I am and create a better system.
49 changes: 28 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@
[![Twitter Follow](https://img.shields.io/twitter/follow/shroominic?style=social)](https://x.com/shroominic)

```bash
> pip install "funcchain[all]"
pip install funcchain
```

## Introduction

`funcchain` is the *most pythonic* way of writing cognitive systems. Leveraging pydantic models as output schemas combined with langchain in the backend allows for a seamless integration of llms into your apps.
It works perfect with OpenAI Functions or LlamaCpp grammars (json-schema-mode).
It utilizes perfect with OpenAI Functions or LlamaCpp grammars (json-schema-mode) for efficient structured output.
In the backend it compiles the funcchain syntax into langchain runnables so you can easily invoke, stream or batch process your pipelines.

[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/ricklamers/funcchain-demo)

Expand Down Expand Up @@ -94,7 +95,7 @@ match lst:
## Vision Models

```python
from PIL import Image
from funcchain import Image
from pydantic import BaseModel, Field
from funcchain import chain, settings

Expand Down Expand Up @@ -132,7 +133,7 @@ from pydantic import BaseModel, Field
from funcchain import chain, settings

# auto-download the model from huggingface
settings.llm = "gguf/openhermes-2.5-mistral-7b"
settings.llm = "ollama/openchat"

class SentimentAnalysis(BaseModel):
analysis: str
Expand All @@ -153,32 +154,38 @@ print(poem.analysis)

## Features

- minimalistic and easy to use
- easy swap between openai and local models
- write prompts as python functions
- pydantic models for output schemas
- langchain core in the backend
- fstrings or jinja templates for prompts
- fully utilises OpenAI Functions or LlamaCpp Grammars
- pythonic
- easy swap between openai or local models
- dynamic output types (pydantic models, or primitives)
- vision llm support
- langchain_core as backend
- jinja templating for prompts
- reliable structured output
- auto retry parsing
- langsmith support
- async and pythonic
- auto gguf model download from huggingface
- streaming support
- sync, async, streaming, parallel, fallbacks
- gguf download from huggingface
- type hints for all functions and mypy support
- chat router component
- composable with langchain LCEL
- easy error handling
- enums and literal support
- custom parsing types

## Documentation

Highly recommend to try out the examples in the `./examples` folder.
[Checkout the docs here](https://shroominic.github.io/funcchain/) 👈

Coming soon... feel free to add helpful .md files :)
Also highly recommend to try and run the examples in the `./examples` folder.

## Contribution

You want to contribute? That's great! Please run the dev setup to get started:
You want to contribute? Thanks, that's great!
For more information checkout the [Contributing Guide](docs/contributing/dev-setup.md).
Please run the dev setup to get started:

```bash
> git clone https://github.com/shroominic/funcchain.git && cd funcchain
git clone https://github.com/shroominic/funcchain.git && cd funcchain

> ./dev_setup.sh
./dev_setup.sh
```

Thanks!
40 changes: 33 additions & 7 deletions dev-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,42 @@
# check if rye is installed
if ! command -v rye &> /dev/null
then
echo "rye could not be found: installing now ..."
curl -sSf https://rye-up.com/get | bash
echo "Check the rye docs for more info: https://rye-up.com/"
echo "rye could not be found"
echo "Would you like to install via rye or pip? Enter 'rye' or 'pip':"
read install_method
clear

if [ "$install_method" = "rye" ]
then
echo "Installing via rye now ..."
curl -sSf https://rye-up.com/get | bash
echo "Check the rye docs for more info: https://rye-up.com/"

elif [ "$install_method" = "pip" ]
then
echo "Installing via pip now ..."
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.lock

else
echo "Invalid option. Please run the script again and enter 'rye' or 'pip'."
exit 1
fi

clear
fi

echo "SYNC: setup .venv"
rye sync
if [ "$install_method" = "rye" ]
then
echo "SYNC: setup .venv"
rye sync

echo "ACTIVATE: activate .venv"
rye shell

echo "ACTIVATE: activate .venv"
rye shell
clear
fi

echo "SETUP: install pre-commit hooks"
pre-commit install
Expand Down
39 changes: 39 additions & 0 deletions docs/advanced/async.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Async

## Why and how to use using async?

Asyncronous promgramming is a way to easily parallelize processes in python.
This is very useful when dealing with LLMs because every request takes a long time and the python interpreter should do alot of other things in the meantime instead of waiting for the request.

Checkout [this brillian async tutorial](https://fastapi.tiangolo.com/async/) if you never coded in an asyncronous way.

## Async in FuncChain

You can use async in funcchain by creating your functions using `achain()` instead of the normal `chain()`.
It would then look like this:

```python
from funcchain import achain

async def generate_poem(topic: str) -> str:
"""
Generate a poem inspired by the given topic.
"""
return await achain()
```

You can then `await` the async `generate_poem` function inside another async funtion or directly call it using `asyncio.run(generate_poem("birds"))`.

## Async in LangChain

When converting your funcchains into a langchain runnable you can use the native langchain way of async.
This would be `.ainvoke(...)`, `.astream(...)` or `.abatch(...)` .

## Async Streaming

You can use langchains async streaming interface but also use the `stream_to(...)` wrapper (explained [here](../concepts/streaming.md#strem_to-wrapper)) as an async context manager.

```python
async with stream_to(...):
await ...
```
9 changes: 9 additions & 0 deletions docs/advanced/codebase-scaling.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Codebase Scaling

## Multi file projects

### TODO

## Structure

### TODO
21 changes: 21 additions & 0 deletions docs/advanced/custom-parser-types.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Custom Parsers

## Example

### TODO

## Grammars

### TODO

## Format Instructions

### TODO

## parse() Function

### TODO

## Write your own Parser

### TODO
17 changes: 17 additions & 0 deletions docs/advanced/customization.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Customization

## extra args inside chain

### TODO

## low level langchain

### TODO

## extra args inside @runnable

### TODO

## custom ll models

### TODO
9 changes: 9 additions & 0 deletions docs/advanced/runnables.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# runnables

## LangChain Expression Language (LCEL)

### TODO

## Streaming, Parallel, Async and

### TODO
9 changes: 9 additions & 0 deletions docs/advanced/signature.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Signature

## Compilation

### TODO

## Schema

### TODO
Loading
Loading