-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #70 from logspace-ai/config
Add config file with option to enable all features
- Loading branch information
Showing
15 changed files
with
170 additions
and
47 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
chains: | ||
- LLMChain | ||
- LLMMathChain | ||
- LLMChecker | ||
# - ConversationChain | ||
|
||
agents: | ||
- ZeroShotAgent | ||
|
||
prompts: | ||
- PromptTemplate | ||
- FewShotPromptTemplate | ||
|
||
llms: | ||
- OpenAI | ||
- OpenAIChat | ||
|
||
tools: | ||
- Search | ||
- PAL-MATH | ||
- Calculator | ||
- Serper Search | ||
|
||
memories: | ||
# - ConversationBufferMemory | ||
|
||
dev: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
import io | ||
import re | ||
from typing import Any, Dict | ||
|
||
from langflow.interface import loading | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import os | ||
from typing import List, Optional | ||
|
||
import yaml | ||
from pydantic import BaseSettings, Field, root_validator | ||
|
||
|
||
class Settings(BaseSettings): | ||
chains: Optional[List[str]] = Field(...) | ||
agents: Optional[List[str]] = Field(...) | ||
prompts: Optional[List[str]] = Field(...) | ||
llms: Optional[List[str]] = Field(...) | ||
tools: Optional[List[str]] = Field(...) | ||
memories: Optional[List[str]] = Field(...) | ||
dev: bool = Field(...) | ||
|
||
class Config: | ||
validate_assignment = True | ||
|
||
@root_validator | ||
def validate_lists(cls, values): | ||
for key, value in values.items(): | ||
if key != "dev" and not value: | ||
values[key] = [] | ||
return values | ||
|
||
|
||
def save_settings_to_yaml(settings: Settings, file_path: str): | ||
with open(file_path, "w") as f: | ||
settings_dict = settings.dict() | ||
yaml.dump(settings_dict, f) | ||
|
||
|
||
def load_settings_from_yaml(file_path: str) -> Settings: | ||
# Check if a string is a valid path or a file name | ||
if "/" not in file_path: | ||
# Get current path | ||
current_path = os.path.dirname(os.path.abspath(__file__)) | ||
|
||
file_path = os.path.join(current_path, file_path) | ||
|
||
with open(file_path, "r") as f: | ||
settings_dict = yaml.safe_load(f) | ||
a = Settings.parse_obj(settings_dict) | ||
|
||
return a | ||
|
||
|
||
settings = load_settings_from_yaml("config.yaml") |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
from pathlib import Path | ||
|
||
from langflow import load_flow_from_json | ||
|
||
|
||
|