Skip to content

Commit 49b689a

Browse files
committed
Merge remote-tracking branch 'refs/remotes/origin/main'
2 parents 0233a39 + 19bc896 commit 49b689a

File tree

4 files changed

+12
-5
lines changed

4 files changed

+12
-5
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ pip install funcchain
1515
## Introduction
1616

1717
`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.
18-
It utilizes perfect with OpenAI Functions or LlamaCpp grammars (json-schema-mode) for efficient structured output.
18+
It utilizes OpenAI Functions or LlamaCpp grammars (json-schema-mode) for efficient structured output.
1919
In the backend it compiles the funcchain syntax into langchain runnables so you can easily invoke, stream or batch process your pipelines.
2020

2121
[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/ricklamers/funcchain-demo)
@@ -112,7 +112,7 @@ class AnalysisResult(BaseModel):
112112
objects: list[str] = Field(description="A list of objects found in the image")
113113

114114
# easy use of images as input with structured output
115-
def analyse_image(image: Image.Image) -> AnalysisResult:
115+
def analyse_image(image: Image) -> AnalysisResult:
116116
"""
117117
Analyse the image and extract its
118118
theme, description and objects.

src/funcchain/backend/settings.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,12 @@ class FuncchainSettings(BaseSettings):
2727
retry_parse: int = 3
2828
retry_parse_sleep: float = 0.1
2929

30-
# KEYS
30+
# KEYS / URLS
3131
openai_api_key: Optional[str] = None
3232
azure_api_key: Optional[str] = None
3333
anthropic_api_key: Optional[str] = None
3434
google_api_key: Optional[str] = None
35+
ollama_base_url: str = "http://localhost:11434"
3536

3637
# MODEL KWARGS
3738
verbose: bool = False
@@ -60,7 +61,9 @@ def openai_kwargs(self) -> dict:
6061
}
6162

6263
def ollama_kwargs(self) -> dict:
63-
return {}
64+
return {
65+
"base_url": self.ollama_base_url
66+
}
6467

6568
def llamacpp_kwargs(self) -> dict:
6669
return {

src/funcchain/model/defaults.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ def univeral_model_selector(
155155
except Exception as e:
156156
print(e)
157157

158-
model_kwargs.pop("model_name")
158+
model_kwargs.pop("model_name", None)
159159

160160
if settings.openai_api_key:
161161
from langchain_openai.chat_models import ChatOpenAI

src/funcchain/syntax/executable.py

+4
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ def chain(
4242

4343
# todo maybe this should be done in the prompt processor?
4444
system = system or settings.system_prompt
45+
if system:
46+
context = [SystemMessage(content=system)] + context
4547
instruction = instruction or from_docstring()
4648

4749
# temp image handling
@@ -90,6 +92,8 @@ async def achain(
9092

9193
# todo maybe this should be done in the prompt processor?
9294
system = system or settings.system_prompt
95+
if system:
96+
context = [SystemMessage(content=system)] + context
9397
instruction = instruction or from_docstring()
9498

9599
# temp image handling

0 commit comments

Comments
 (0)