Skip to content

Commit

Permalink
[cfs] major version change
Browse files Browse the repository at this point in the history
  • Loading branch information
yashbonde committed Oct 13, 2023
1 parent a272e8f commit 6e9f852
Show file tree
Hide file tree
Showing 15 changed files with 16 additions and 23 deletions.
2 changes: 1 addition & 1 deletion api_docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
project = "ChainFury"
copyright = "2023, NimbleBox Engineering"
author = "NimbleBox Engineering"
release = "1.5.0"
release = "1.6.0"

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
Expand Down
2 changes: 1 addition & 1 deletion cf_internal
6 changes: 3 additions & 3 deletions chainfury/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1159,7 +1159,7 @@ def from_dag(cls, dag: T.Dag, check_server: bool = True):
from chainfury.client import get_client

stub = get_client()
action, err = stub.fury.actions.u(node.cf_id)()
action, err = stub.fury.u(node.cf_id)()
if err:
raise ValueError(f"Action {node.cf_id} not loaded: {action}")
cf_action = Node.from_dict(action)
Expand Down Expand Up @@ -1205,9 +1205,9 @@ def from_id(cls, id: str):
from chainfury.client import get_client

stub = get_client()
chain, err = stub.chatbot.u(id)()
chain, err = stub.chains.u(id)(_verbose=True)
if err:
raise ValueError(f"Could not get chain with id {id}: {chain}")
raise ValueError(f"Could not get chain with id '{id}', error: {chain}")
chain = T.ApiChain(**chain)
if chain.dag is None:
raise ValueError(f"Chain {id} has no dag")
Expand Down
7 changes: 4 additions & 3 deletions chainfury/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
from fire import Fire

from chainfury import Chain
from chainfury.utils import logger
from chainfury.client import get_client
from chainfury.version import __version__
from chainfury.components import all_items
from chainfury.agent import model_registry, programatic_actions_registry, memory_registry
Expand Down Expand Up @@ -58,7 +56,10 @@ def run(
with open(inp, "r") as f:
inp = json.load(f)
else:
inp = json.loads(inp)
try:
inp = json.loads(inp)
except Exception as e:
raise ValueError("Input must be a valid json string or a json file path")
assert isinstance(inp, dict), "Input must be a dict"

# create chain
Expand Down
4 changes: 2 additions & 2 deletions chainfury/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def __repr__(self):

def __getattr__(self, attr: str):
# https://stackoverflow.com/questions/3278077/difference-between-getattr-vs-getattribute
return Subway(f"{self._url}/{attr}", self._session)
return Subway(f"{self._url}/{attr}", self._session, self._trailing)

def u(self, attr: str) -> "Subway":
"""In cases where the api might start with a number you cannot write in python, this method can be used to
Expand Down Expand Up @@ -134,7 +134,7 @@ def __call__(


@lru_cache(maxsize=1)
def get_client(prefix: str = "api/v1", url="", token: str = "", trailing: str = "") -> Subway:
def get_client(prefix: str = "/api/", url="", token: str = "", trailing: str = "/") -> Subway:
"""This function returns a Subway object that can be used to interact with the API.
Example:
Expand Down
2 changes: 1 addition & 1 deletion chainfury/version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "1.5.0"
__version__ = "1.6.0"
_major, _minor, _patch = __version__.split(".")
_major = int(_major)
_minor = int(_minor)
Expand Down
Binary file removed docs/1.png
Binary file not shown.
Binary file removed docs/2.png
Binary file not shown.
Binary file removed docs/3.png
Binary file not shown.
Binary file removed docs/4.png
Binary file not shown.
Binary file removed docs/5.png
Binary file not shown.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "chainfury"
version = "1.5.0"
version = "1.6.0"
description = "ChainFury is a powerful tool that simplifies the creation and management of chains of prompts, making it easier to build complex chat applications using LLMs."
authors = ["NimbleBox Engineering <[email protected]>"]
license = "Apache 2.0"
Expand Down
10 changes: 1 addition & 9 deletions server/chainfury_server/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,7 @@
# WARNING: do not import anything from anywhere here, this is the place where chainfury_server starts.
# importing anything can cause the --pre and --post flags to fail when starting server.


def get_logger(name) -> logging.Logger:
temp_logger = logging.getLogger(name)
temp_logger.setLevel(logging.INFO)
return temp_logger


logging.basicConfig(level=logging.INFO, format="%(asctime)s - %(name)s - %(levelname)s - %(message)s")
logger = get_logger("cf_server") # type: ignore
from chainfury.utils import logger # keep this here, rest of package imports from this file


class Env:
Expand Down
2 changes: 1 addition & 1 deletion server/chainfury_server/version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "1.1.0"
__version__ = "2.0.0"
_major, _minor, _patch = __version__.split(".")
_major = int(_major)
_minor = int(_minor)
Expand Down
2 changes: 1 addition & 1 deletion server/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "chainfury_server"
version = "1.1.0"
version = "2.0.0"
description = "ChainFury Server is the open source server for running ChainFury Engine!"
authors = ["NimbleBox Engineering <[email protected]>"]
license = "Apache 2.0"
Expand Down

0 comments on commit 6e9f852

Please sign in to comment.