-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
483668b
commit 188a5c5
Showing
7 changed files
with
89 additions
and
20 deletions.
There are no files selected for viewing
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,7 +1,11 @@ | ||
class: "LLMSession" | ||
just_streaming_method: "openai" | ||
system_prompt_path: | ||
system_prompt: | ||
completion_remove_key_on_error: True | ||
completion_max_tries: 2 | ||
backup_options: | ||
key_list_path: | ||
key_list_path: | ||
tools: | ||
# - package: | ||
# function: |
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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
from typing import AsyncGenerator, Any | ||
|
||
def build_agent(agent_schema: dict): | ||
from just_agents.cot_agent import ChainOfThoughtAgent | ||
from just_agents.llm_session import LLMSession | ||
class_name = agent_schema.get("class", None) | ||
if class_name is None: | ||
raise ValueError("Error class_name field should not be empty in agent_schema param during IAgent.build() call.") | ||
elif class_name == "LLMSession": | ||
return LLMSession(agent_schema=agent_schema) | ||
elif class_name == "ChainOfThoughtAgent": | ||
return ChainOfThoughtAgent(agent_schema=agent_schema) | ||
|
||
class IAgent: | ||
|
||
# @staticmethod | ||
# def build(agent_schema: dict): | ||
# import importlib | ||
# try: | ||
# package_name = agent_schema.get("package", None) | ||
# class_name = agent_schema.get("class", None) | ||
# | ||
# if package_name is None: | ||
# raise ValueError("Error package_name field should not be empty in agent_schema param during IAgent.build() call.") | ||
# if class_name is None: | ||
# raise ValueError("Error class_name field should not be empty in agent_schema param during IAgent.build() call.") | ||
# # Dynamically import the package | ||
# package = importlib.import_module(package_name) | ||
# # Get the class from the package | ||
# class_ = getattr(package, class_name) | ||
# # Create an instance of the class | ||
# instance = class_(agent_schema=agent_schema) | ||
# | ||
# return instance | ||
# except (ImportError, AttributeError) as e: | ||
# print(f"Error creating instance of {class_name} from {package_name}: {e}") | ||
# return None | ||
|
||
|
||
def stream(self, input: str | dict | list[dict]) -> AsyncGenerator[Any, None]: | ||
raise NotImplementedError("You need to impelement stream_add_all() first!") | ||
|
||
def query(self, input: str | dict | list[dict]) -> str: | ||
raise NotImplementedError("You need to impelement query_add_all() first!") |
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