From e58b495633329af955ae245e6c3979dd4dfb5513 Mon Sep 17 00:00:00 2001 From: Shroominic Date: Tue, 30 Jan 2024 13:54:30 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=9D=20markdownlint-disable?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/contributing/code-of-conduct.md | 2 +- docs/features/chat.md | 1 + docs/features/dynamic_router.md | 13 ++++----- docs/features/enums.md | 3 +- docs/features/error_output.md | 1 + docs/features/literals.md | 1 + docs/features/ollama.md | 2 ++ docs/features/openai_json_mode.md | 1 + docs/features/pydantic_validation.md | 20 ++++++++------ docs/features/static_router.md | 1 + docs/features/stream.md | 1 + docs/features/vision.md | 1 + docs/getting-started/installation.md | 1 + docs/getting-started/introduction.md | 41 ++++++++++------------------ docs/index.md | 1 + 15 files changed, 44 insertions(+), 46 deletions(-) diff --git a/docs/contributing/code-of-conduct.md b/docs/contributing/code-of-conduct.md index b046dc9..148c2a8 100644 --- a/docs/contributing/code-of-conduct.md +++ b/docs/contributing/code-of-conduct.md @@ -40,4 +40,4 @@ Project maintainers who do not follow or enforce the Code of Conduct in good fai ## Attribution -This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org), version 1.4, available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html +This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org). diff --git a/docs/features/chat.md b/docs/features/chat.md index e4228d3..8eb3ad6 100644 --- a/docs/features/chat.md +++ b/docs/features/chat.md @@ -1,3 +1,4 @@ + # ChatGPT rebuild with memory/history !!! Example diff --git a/docs/features/dynamic_router.md b/docs/features/dynamic_router.md index 27f1cce..bb798a5 100644 --- a/docs/features/dynamic_router.md +++ b/docs/features/dynamic_router.md @@ -1,3 +1,4 @@ + # Dynamic Chat Router with Funcchain !!! Example @@ -19,8 +20,6 @@ from typing import Any, Callable, TypedDict from funcchain.syntax.executable import compile_runnable from pydantic import BaseModel, Field -# Dynamic Router Definition: - class Route(TypedDict): handler: Callable @@ -63,9 +62,6 @@ class DynamicChatRouter(BaseModel): return self.routes[selected_route]["handler"](user_query, **kwargs) -# Example Usage: - - def handle_pdf_requests(user_query: str) -> str: return "Handling PDF requests with user query: " + user_query @@ -99,11 +95,11 @@ router = DynamicChatRouter( router.invoke_route("Can you summarize this csv?") ``` -Demo +## Demo
```python -User: +Input: $ Can you summarize this csv? $ ............... Handling CSV requests with user query: Can you summarize this csv? @@ -115,7 +111,8 @@ Handling CSV requests with user query: Can you summarize this csv? !!! Step-by-Step **Nececary imports** - ``` + + ```python from enum import Enum from typing import Any, Callable, TypedDict diff --git a/docs/features/enums.md b/docs/features/enums.md index 3cfe7ab..8086942 100644 --- a/docs/features/enums.md +++ b/docs/features/enums.md @@ -1,4 +1,5 @@ -## Decision Making with Enums and Funcchain + +# Decision Making with Enums and Funcchain !!! Example See [enums.py](https://github.com/shroominic/funcchain/blob/main/examples/enums.py) diff --git a/docs/features/error_output.md b/docs/features/error_output.md index 7fcfcf5..0dccf55 100644 --- a/docs/features/error_output.md +++ b/docs/features/error_output.md @@ -1,3 +1,4 @@ + # Example of raising an error !!! Example diff --git a/docs/features/literals.md b/docs/features/literals.md index 2d6d0c5..ee9b26d 100644 --- a/docs/features/literals.md +++ b/docs/features/literals.md @@ -1,3 +1,4 @@ + # Literal Type Enforcement in Funcchain !!! Example diff --git a/docs/features/ollama.md b/docs/features/ollama.md index fda60bb..b433c76 100644 --- a/docs/features/ollama.md +++ b/docs/features/ollama.md @@ -1,3 +1,4 @@ + # Different LLMs with funcchain EASY TO USE !!! Example @@ -57,6 +58,7 @@ if __name__ == "__main__":
## Instructions + !!! Step-by-Step **Necessary Imports** diff --git a/docs/features/openai_json_mode.md b/docs/features/openai_json_mode.md index ec5f769..c2bcd38 100644 --- a/docs/features/openai_json_mode.md +++ b/docs/features/openai_json_mode.md @@ -1,3 +1,4 @@ + # JSON structured Output using Funcchain with OenAI !!! Example diff --git a/docs/features/pydantic_validation.md b/docs/features/pydantic_validation.md index 7182d46..f1d2458 100644 --- a/docs/features/pydantic_validation.md +++ b/docs/features/pydantic_validation.md @@ -1,3 +1,4 @@ + # Task Creation with Validated Fields !!! Example @@ -51,22 +52,23 @@ if __name__ == "__main__": Demo
-```python -User: -$ cleanup the kitchen + ```python + User: + $ cleanup the kitchen -task=Task -name='cleanup', -difficulty=30, -keywords=['kitchen', 'cleanup'] + task=Task + name='cleanup', + difficulty=30, + keywords=['kitchen', 'cleanup'] + ``` -```
-##Instructions +## Instructions !!! Step-by-Step **Necessary Imports** + ```python from funcchain import chain, settings from pydantic import BaseModel, field_validator diff --git a/docs/features/static_router.md b/docs/features/static_router.md index 9b44955..753feef 100644 --- a/docs/features/static_router.md +++ b/docs/features/static_router.md @@ -1,3 +1,4 @@ + # Static Routing with Funcchain and Pydantic !!! Example diff --git a/docs/features/stream.md b/docs/features/stream.md index d93b390..a9b3412 100644 --- a/docs/features/stream.md +++ b/docs/features/stream.md @@ -1,3 +1,4 @@ + # Streaming with Funcchain !!! Example diff --git a/docs/features/vision.md b/docs/features/vision.md index e146a64..323b218 100644 --- a/docs/features/vision.md +++ b/docs/features/vision.md @@ -1,3 +1,4 @@ + # Image Analysis with Funcchain and Pydantic !!! Example diff --git a/docs/getting-started/installation.md b/docs/getting-started/installation.md index 4444556..d6c3b9f 100644 --- a/docs/getting-started/installation.md +++ b/docs/getting-started/installation.md @@ -1,3 +1,4 @@ + # Installation
diff --git a/docs/getting-started/introduction.md b/docs/getting-started/introduction.md index 2d7e897..5e52abc 100644 --- a/docs/getting-started/introduction.md +++ b/docs/getting-started/introduction.md @@ -1,3 +1,6 @@ + +# Introduction + [![Version](https://badge.fury.io/py/funcchain.svg)](https://badge.fury.io/py/funcchain) [![tests](https://github.com/shroominic/funcchain/actions/workflows/code-check.yml/badge.svg)](https://github.com/shroominic/funcchain/actions/workflows/code-check.yml) ![PyVersion](https://img.shields.io/pypi/pyversions/funcchain) @@ -14,21 +17,6 @@
-!!! Useful: Langsmith integration - - Add those lines to .env and funcchain will use langsmith tracing. - - ```bash - LANGCHAIN_TRACING_V2=true - LANGCHAIN_API_KEY="ls__api_key" - LANGCHAIN_PROJECT="PROJECT_NAME" - ``` - - Langsmith is used to understand what happens under the hood of your LLM generations. - When multiple LLM calls are used for an output they can be logged for debugging. - -## 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 and soon with other models using JSONFormer. @@ -340,8 +328,6 @@ for obj in result.objects: Its important that the fields defined earlier are mentioned here with the prompt `Analyse the image and extract its`... -## Demo -
``` print(analyse_image(image: Image.Image)) @@ -395,8 +381,7 @@ print(poem.analysis) ```python from pydantic import BaseModel, Field from funcchain import chain, settings - -``` + ``` **Choose and enjoy** ```python @@ -435,18 +420,20 @@ print(poem.analysis) print(poem.analysis) ``` -# Demo - -
- ``` - poem = analyze("I really like when my dog does a trick!") +
- $ .................. +!!! Useful: Langsmith integration - Add demo + Add those lines to .env and funcchain will use langsmith tracing. + ```bash + LANGCHAIN_TRACING_V2=true + LANGCHAIN_API_KEY="ls__api_key" + LANGCHAIN_PROJECT="PROJECT_NAME" ``` -
+ + Langsmith is used to understand what happens under the hood of your LLM generations. + When multiple LLM calls are used for an output they can be logged for debugging. ## Features diff --git a/docs/index.md b/docs/index.md index 8408aa7..7a289dc 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,3 +1,4 @@ + # Introduction [![Version](https://badge.fury.io/py/funcchain.svg)](https://badge.fury.io/py/funcchain)