Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Models superagi #1117

Merged
merged 93 commits into from
Aug 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
93 commits
Select commit Hold shift + click to select a range
46ae580
adding llama2 changes using replicate
Jul 19, 2023
4dbe326
Adding misssing llm file
Jul 19, 2023
18da502
Update llm_model_factory.py
Jul 20, 2023
fd48dc7
Update token_counter.py
Jul 20, 2023
83a5dc1
adding replicate token in the config_example
Jul 21, 2023
c3b2a36
Update replicate.py
Jul 25, 2023
1ccd2cd
First Commit for Models
jedan2506 Aug 1, 2023
642b4b7
Second Commit for Models
jedan2506 Aug 1, 2023
43ecd31
Third Commit for Models
jedan2506 Aug 1, 2023
09f9cc7
Updated
jedan2506 Aug 1, 2023
5d75e13
Replicate Branch Merged
jedan2506 Aug 2, 2023
445c497
Updates
jedan2506 Aug 2, 2023
3da3d30
Merge branch 'dev' of github.com:TransformerOptimus/SuperAGI into mod…
jedan2506 Aug 2, 2023
f71338a
Updates
jedan2506 Aug 2, 2023
14edd62
Updates
jedan2506 Aug 2, 2023
f691411
Updates
jedan2506 Aug 3, 2023
3bbdc31
updates
jedan2506 Aug 3, 2023
f95f656
updates
jedan2506 Aug 3, 2023
d5f9411
updates
jedan2506 Aug 3, 2023
fadf8b1
Updates
jedan2506 Aug 4, 2023
57c3853
Updates
jedan2506 Aug 4, 2023
40f2d76
Updates
jedan2506 Aug 4, 2023
c8d42a7
Updates
jedan2506 Aug 4, 2023
91136ad
Updates
jedan2506 Aug 7, 2023
fcbfd17
Updates
jedan2506 Aug 7, 2023
8ff83b0
Updates
jedan2506 Aug 7, 2023
78ff836
Updates
jedan2506 Aug 7, 2023
fa4b38c
Updates
jedan2506 Aug 7, 2023
43bdd44
Updates
jedan2506 Aug 7, 2023
8bd95e6
Updates
jedan2506 Aug 7, 2023
ad9bc21
Updates
jedan2506 Aug 8, 2023
f5f2998
Updates
jedan2506 Aug 8, 2023
854e88c
Updates
jedan2506 Aug 9, 2023
52cb4aa
Updates
jedan2506 Aug 9, 2023
ec7c271
Updates
jedan2506 Aug 9, 2023
94d5977
Bug Fixes
jedan2506 Aug 10, 2023
f314325
Updates
jedan2506 Aug 10, 2023
955d648
Updates
jedan2506 Aug 10, 2023
adcf3a5
Updates
jedan2506 Aug 11, 2023
775fad7
Updates
jedan2506 Aug 13, 2023
ba7c9c6
Updates
jedan2506 Aug 16, 2023
9dbe3a3
Updates
jedan2506 Aug 16, 2023
27a2147
Updates
jedan2506 Aug 16, 2023
21e601b
Updates
jedan2506 Aug 17, 2023
02475a7
Updates
jedan2506 Aug 17, 2023
ab7ffe2
Updates
jedan2506 Aug 17, 2023
b712620
Updates
jedan2506 Aug 17, 2023
2601682
Updates
jedan2506 Aug 17, 2023
22e5c32
Updates
jedan2506 Aug 18, 2023
b9bafb0
Updates
jedan2506 Aug 18, 2023
5fc3c42
Updates
jedan2506 Aug 18, 2023
e01ccfe
Updates
jedan2506 Aug 18, 2023
3805f99
Updates
jedan2506 Aug 18, 2023
6729c11
Updates
jedan2506 Aug 18, 2023
3ac9ffa
Updates
jedan2506 Aug 18, 2023
0ec2709
Updates
jedan2506 Aug 18, 2023
12e904e
Updates
jedan2506 Aug 21, 2023
6e4efdd
Updates
jedan2506 Aug 21, 2023
3884f0a
Updates
jedan2506 Aug 21, 2023
87160ac
Updates
jedan2506 Aug 21, 2023
5ce47ce
Updates
jedan2506 Aug 21, 2023
05b14d9
Updates
jedan2506 Aug 22, 2023
edb27cd
Updates
jedan2506 Aug 22, 2023
db17d1b
Updates
jedan2506 Aug 22, 2023
4ff94f9
Updates
jedan2506 Aug 22, 2023
c0d3f44
Updates
jedan2506 Aug 22, 2023
9593ce9
Updates
jedan2506 Aug 22, 2023
91fd6a8
Updates
jedan2506 Aug 22, 2023
de30cb9
Updates
jedan2506 Aug 23, 2023
16671b0
Updates
jedan2506 Aug 23, 2023
83f37d1
Updates
jedan2506 Aug 23, 2023
c100b21
Updates
jedan2506 Aug 23, 2023
619c2fa
Updates
jedan2506 Aug 23, 2023
bdb7f85
Updates
jedan2506 Aug 23, 2023
fe63ddc
Updates
jedan2506 Aug 23, 2023
560870e
Updates
jedan2506 Aug 23, 2023
e0a3054
Updates
jedan2506 Aug 23, 2023
fdb4154
Updates
jedan2506 Aug 23, 2023
165e073
Updates
jedan2506 Aug 23, 2023
c00bb98
Updates
jedan2506 Aug 24, 2023
9cb7185
Updates
jedan2506 Aug 24, 2023
d4e1469
Updates
jedan2506 Aug 24, 2023
d8d4b3b
Updates
jedan2506 Aug 24, 2023
9199791
Merge branch 'dev' of github.com:TransformerOptimus/SuperAGI into mod…
jedan2506 Aug 24, 2023
39f3ba5
Updates
jedan2506 Aug 24, 2023
5fde03e
Updates
jedan2506 Aug 24, 2023
54d1e5c
Updates
jedan2506 Aug 24, 2023
3afd372
Updates
jedan2506 Aug 24, 2023
67b9595
Updates
jedan2506 Aug 24, 2023
d01323a
Updates
jedan2506 Aug 24, 2023
554da11
Updates
jedan2506 Aug 24, 2023
a51f325
Merge branch 'dev' of github.com:TransformerOptimus/SuperAGI into mod…
jedan2506 Aug 24, 2023
00977f2
Updates
jedan2506 Aug 24, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion superagi/agent/agent_iteration_step_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def execute_step(self):
if 'content' not in response or response['content'] is None:
raise RuntimeError(f"Failed to get response from llm")

total_tokens = current_tokens + TokenCounter(session=self.session, organisation_id=organisation.id).count_message_tokens(response['content'], self.llm.get_model())
total_tokens = current_tokens + TokenCounter.count_message_tokens(response['content'], self.llm.get_model())
AgentExecution.update_tokens(self.session, self.agent_execution_id, total_tokens)
try:
content = json.loads(response['content'])
Expand Down
2 changes: 1 addition & 1 deletion superagi/agent/agent_tool_step_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def _build_tool_obj(self, agent_config, agent_execution_config, tool_name: str):
if tool_name == "QueryResourceTool":
resource_summary = ResourceSummarizer(session=self.session,
agent_id=self.agent_id,
model= agent_config["model"]).fetch_or_create_agent_resource_summary(
model=agent_config["model"]).fetch_or_create_agent_resource_summary(
default_summary=agent_config.get("resource_summary"))

organisation = Agent.find_org_by_agent_id(self.session, self.agent_id)
Expand Down
4 changes: 3 additions & 1 deletion superagi/agent/queue_step_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from superagi.models.agent_execution_feed import AgentExecutionFeed
from superagi.models.workflows.agent_workflow_step import AgentWorkflowStep
from superagi.models.workflows.agent_workflow_step_tool import AgentWorkflowStepTool
from superagi.models.agent import Agent
from superagi.types.queue_status import QueueStatus


Expand All @@ -22,6 +23,7 @@ def __init__(self, session, llm, agent_id: int, agent_execution_id: int):
self.llm = llm
self.agent_execution_id = agent_execution_id
self.agent_id = agent_id
self.organisation = Agent.find_org_by_agent_id(self.session, agent_id=self.agent_id)

def _queue_identifier(self, step_tool):
return step_tool.unique_id + "_" + str(self.agent_execution_id)
Expand Down Expand Up @@ -87,7 +89,7 @@ def _process_input_instruction(self, step_tool):
.build_agent_messages(prompt, agent_feeds, history_enabled=step_tool.history_enabled,
completion_prompt=step_tool.completion_prompt)
current_tokens = TokenCounter.count_message_tokens(messages, self.llm.get_model())
response = self.llm.chat_completion(messages, TokenCounter.token_limit(self.llm.get_model()) - current_tokens)
response = self.llm.chat_completion(messages, TokenCounter(session=self.session, organisation_id=self.organisation.id).token_limit(self.llm.get_model()) - current_tokens)
if 'content' not in response or response['content'] is None:
raise RuntimeError(f"Failed to get response from llm")
total_tokens = current_tokens + TokenCounter.count_message_tokens(response, self.llm.get_model())
Expand Down
6 changes: 4 additions & 2 deletions superagi/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from superagi.config.config import get_config
from superagi.helper.agent_schedule_helper import AgentScheduleHelper
from superagi.models.configuration import Configuration

from superagi.models.agent import Agent
from superagi.models.db import connect_db
from superagi.types.model_source_types import ModelSourceType

Expand Down Expand Up @@ -71,7 +71,9 @@ def summarize_resource(agent_id: int, resource_id: int):
engine = connect_db()
Session = sessionmaker(bind=engine)
session = Session()
model_source = Configuration.fetch_value_by_agent_id(session, agent_id, "model_source") or "OpenAi"
agent_config = Agent.fetch_configuration(session, agent_id)
organisation = Agent.find_org_by_agent_id(session, agent_id)
model_source = Configuration.fetch_configurations(session, organisation.id, "model_source", agent_config["model"]) or "OpenAi"
if ModelSourceType.GooglePalm.value in model_source or ModelSourceType.Replicate.value in model_source:
return

Expand Down