Skip to content

Commit

Permalink
fixed web package
Browse files Browse the repository at this point in the history
  • Loading branch information
antonkulaga committed Jan 6, 2025
1 parent ab73436 commit 7a03773
Show file tree
Hide file tree
Showing 27 changed files with 786 additions and 242 deletions.
6 changes: 3 additions & 3 deletions coding/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "just-agents-coding"
version = "0.4.4"
version = "0.4.5"
description = "Just Agents - Coding Components"
authors = [
"Alex Karmazin <karmazinalex@gmail.com>",
Expand All @@ -19,8 +19,8 @@ license = "MIT"

[tool.poetry.dependencies]
python = ">=3.10,<4.0"
just-agents-core = ">=0.4.3"
llm-sandbox = ">=0.1.4"
just-agents-core = ">=0.4.5"
llm-sandbox = ">=0.1.8"

[build-system]
requires = ["poetry-core"]
Expand Down
29 changes: 29 additions & 0 deletions config/agent_profiles.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
agent_profiles:
SecretaryAgent:
autoload_from_yaml: false
backstory: Developed to assist in the understanding and documentation of AI agents.
class_qualname: just_agents.router.secretary_agent.SecretaryAgent
description: A skilled AI assistant specializing in the generation of concise
and detail-rich profiles for AI agents.
expertise_domain: AI agent profiling and analysis.
extra_dict:
personality_traits: Agent's personality traits go here
goal: To generate detailed profiles for AI agents.
knowledge_sources: []
limitations: Limited to the information available up to October 2023.
llm_options:
model: gpt-4o-mini
temperature: 0.0
model_name: gpt-4o-mini
personality_traits: Skilled, detail-oriented, concise, analytical
role: AI assistant.
system_prompt: |2-
You are a skilled AI assistant specializing in analysis and description of AI agents.
You are tasked with generation of a minimalistic and concise yet detail-rich profile for an AI agent, based on the AVAILABLE_ATTRIBUTES,
including 'system_prompt', 'llm_options' and any other. Your task is to fill in values of a JSON-formatted profile
that matches the PROFILE_UPDATE_TEMPLATE provided below. Values of the template describe what output is expected for each field.
Only populate fields based on the well-established information, don't make up anything.
Double-check that the output contains only a valid JSON with all the fields specified in PROFILE_UPDATE_TEMPLATE.
Never include any additional text or explanations in your reply.
task: Analysis and description of AI agents.
2 changes: 1 addition & 1 deletion core/just_agents/simple/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

This is a legacy package, left for backward compatibility.
Here you see initial implementation of agents, which are now deprecated.
These implementations are simplier than the current ones but with less features.
These implementations are simplier than the current ones but with less features.
3 changes: 2 additions & 1 deletion core/just_agents/simple/chat_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

from just_agents.simple.llm_session import LLMSession
from just_agents.simple.utils import load_config
from deprecated import deprecated


@deprecated(reason="This is old memory implementation, everything in simple package is deprecated")
class ChatAgent(LLMSession):
"""
Default agent class, it assumes that each agent has a role, goal, and background story.
Expand Down
2 changes: 2 additions & 0 deletions core/just_agents/simple/cot_agent.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from deprecated import deprecated
from just_agents.interfaces.agent import IAgent
from just_agents.simple.llm_session import LLMSession
import json
Expand All @@ -17,6 +18,7 @@
FINAL_PROMPT = "final_prompt"


@deprecated(reason="This is old memory implementation, everything in simple package is deprecated")
class ChainOfThoughtAgent(IAgent):

def __init__(self, llm_options: dict = None, agent_schema: str | Path | dict | None = None,
Expand Down
3 changes: 2 additions & 1 deletion core/just_agents/simple/llm_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from pathlib import Path
from typing import Any, AsyncGenerator

from deprecated import deprecated
import litellm
from litellm import ModelResponse, completion
from litellm.utils import Choices
Expand All @@ -29,7 +30,7 @@
QWEN2 = "qwen2"
CHAIN_OF_THOUGHT = "chain_of_thought"


@deprecated(reason="This is old memory implementation, everything in simple package is deprecated")
class LLMSession(
IAgent[
str | dict | list[dict],
Expand Down
2 changes: 2 additions & 0 deletions core/just_agents/simple/memory.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from dataclasses import dataclass, field
from typing import Callable, Optional
from litellm.types.utils import Function
from deprecated import deprecated

OnMessageCallable = Callable[[dict], None]
OnFunctionCallable = Callable[[Function], None]
Expand All @@ -10,6 +11,7 @@
ASSISTANT = "assistant"
SYSTEM = "system"

@deprecated(reason="This is old memory implementation, everything in simple package is deprecated")
class Memory:
def __init__(self):
self.on_message:dict[str, list] = {TOOL:[], USER:[], ASSISTANT:[], SYSTEM:[]}
Expand Down
2 changes: 2 additions & 0 deletions core/just_agents/simple/streaming/chain_of_thought.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
from just_agents.protocols.openai_streaming import OpenaiStreamingProtocol
from just_agents.interfaces.streaming_protocol import IAbstractStreamingProtocol
import json
from deprecated import deprecated

@deprecated(reason="This is old memory implementation, everything in simple package is deprecated")
class ChainOfThought(AbstractStreaming):

def __init__(self, llm_session, output_streaming: IAbstractStreamingProtocol = OpenaiStreamingProtocol()):
Expand Down
3 changes: 2 additions & 1 deletion core/just_agents/simple/streaming/openai_streaming.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
from just_agents.simple.streaming.protocols.abstract_streaming import AbstractStreaming, FunctionParser
from just_agents.interfaces.streaming_protocol import IAbstractStreamingProtocol
from just_agents.protocols.openai_streaming import OpenaiStreamingProtocol
from deprecated import deprecated


@deprecated(reason="This is old memory implementation, everything in simple package is deprecated")
class AsyncSession(AbstractStreaming):

def __init__(self, llm_session, output_streaming: IAbstractStreamingProtocol = OpenaiStreamingProtocol()):
Expand Down
3 changes: 2 additions & 1 deletion core/just_agents/simple/streaming/qwen2_streaming.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
import json
from qwen_agent.llm import get_chat_model # deprecated, so far we do not use qwen_agent
import litellm
from deprecated import deprecated


@deprecated(reason="This is old memory implementation, everything in simple package is deprecated")
class Qwen2AsyncSession(AbstractStreaming):

def __init__(self, llm_session, output_streaming: IAbstractStreamingProtocol = OpenaiStreamingProtocol()):
Expand Down
2 changes: 1 addition & 1 deletion core/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "just-agents-core"
version = "0.4.4"
version = "0.4.5"
description = "Just Agents - Base Package"
authors = [
"Alex Karmazin <karmazinalex@gmail.com>",
Expand Down
32 changes: 26 additions & 6 deletions examples/just_agents/examples/web/nice_agent.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,26 @@
system_prompt: "You are super-nice assistant that could help with anything.
You communicate in a very friendly and positive informal way."
options:
model: "groq/llama-3.1-70b-versatile"
api_base: "https://api.groq.com/openai/v1"
temperature: 0.0
agent_profiles:
SimpleWeatherAgent:
class_qualname: just_agents.base_agent.BaseAgent
llm_options:
api_base: https://api.groq.com/openai/v1
model: groq/llama-3.3-70b-versatile
temperature: 0.0
tool_choice: auto
tools: []
tools:
mock_get_current_weather:
arguments:
- location:
default: null
kind: POSITIONAL_OR_KEYWORD
type_annotation: <class 'str'>
description: Gets the current weather in a given location
function: mock_get_current_weather
package: just_agents.tools.weather
parameters:
properties:
location:
type: string
required:
- location
type: object
5 changes: 3 additions & 2 deletions examples/just_agents/examples/web/nice_web.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
from dotenv import load_dotenv
from just_agents.interfaces.agent import IAgent
from just_agents.simple.utils import build_agent
from just_agents_web.web import create_app, run_server
from just_agents.web.rest_api import *
from just_agents.web.run import *

load_dotenv(override=True)

Expand All @@ -15,4 +16,4 @@

if __name__ == "__main__":
cofig_path = web_examples_dir / "nice_agent.yaml"
run_server(config_path=cofig_path)
run_server(config=cofig_path, agent_parent_section="agent_profiles", agent_section="SimpleWeatherAgent")
4 changes: 2 additions & 2 deletions examples/notebooks/01_just_agents_colab.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
"Requirement already satisfied: anyio<5,>=3.5.0 in /usr/local/lib/python3.10/dist-packages (from openai>=1.54.0->litellm>=1.51.0->just-agents) (3.7.1)\n",
"Requirement already satisfied: distro<2,>=1.7.0 in /usr/local/lib/python3.10/dist-packages (from openai>=1.54.0->litellm>=1.51.0->just-agents) (1.9.0)\n",
"Requirement already satisfied: httpx<1,>=0.23.0 in /usr/local/lib/python3.10/dist-packages (from openai>=1.54.0->litellm>=1.51.0->just-agents) (0.27.2)\n",
"Requirement already satisfied: jiter<1,>=0.4.3 in /usr/local/lib/python3.10/dist-packages (from openai>=1.54.0->litellm>=1.51.0->just-agents) (0.7.0)\n",
"Requirement already satisfied: jiter<1,>=0.4.5 in /usr/local/lib/python3.10/dist-packages (from openai>=1.54.0->litellm>=1.51.0->just-agents) (0.7.0)\n",
"Requirement already satisfied: sniffio in /usr/local/lib/python3.10/dist-packages (from openai>=1.54.0->litellm>=1.51.0->just-agents) (1.3.1)\n",
"Requirement already satisfied: tqdm>4 in /usr/local/lib/python3.10/dist-packages (from openai>=1.54.0->litellm>=1.51.0->just-agents) (4.66.6)\n",
"Requirement already satisfied: annotated-types>=0.6.0 in /usr/local/lib/python3.10/dist-packages (from pydantic<3.0.0,>=2.0.0->litellm>=1.51.0->just-agents) (0.7.0)\n",
Expand Down Expand Up @@ -154,7 +154,7 @@
}
],
"source": [
"!pip install just-agents-core==0.4.3"
"!pip install just-agents-core==0.4.5"
]
},
{
Expand Down
6 changes: 3 additions & 3 deletions examples/notebooks/02_sqlite_example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@
"Requirement already satisfied: anyio<5,>=3.5.0 in /usr/local/lib/python3.10/dist-packages (from openai>=1.54.0->litellm>=1.51.0->just-agents) (3.7.1)\n",
"Requirement already satisfied: distro<2,>=1.7.0 in /usr/local/lib/python3.10/dist-packages (from openai>=1.54.0->litellm>=1.51.0->just-agents) (1.9.0)\n",
"Requirement already satisfied: httpx<1,>=0.23.0 in /usr/local/lib/python3.10/dist-packages (from openai>=1.54.0->litellm>=1.51.0->just-agents) (0.27.2)\n",
"Requirement already satisfied: jiter<1,>=0.4.3 in /usr/local/lib/python3.10/dist-packages (from openai>=1.54.0->litellm>=1.51.0->just-agents) (0.7.0)\n",
"Requirement already satisfied: jiter<1,>=0.4.5 in /usr/local/lib/python3.10/dist-packages (from openai>=1.54.0->litellm>=1.51.0->just-agents) (0.7.0)\n",
"Requirement already satisfied: sniffio in /usr/local/lib/python3.10/dist-packages (from openai>=1.54.0->litellm>=1.51.0->just-agents) (1.3.1)\n",
"Requirement already satisfied: tqdm>4 in /usr/local/lib/python3.10/dist-packages (from openai>=1.54.0->litellm>=1.51.0->just-agents) (4.66.6)\n",
"Requirement already satisfied: annotated-types>=0.6.0 in /usr/local/lib/python3.10/dist-packages (from pydantic<3.0.0,>=2.0.0->litellm>=1.51.0->just-agents) (0.7.0)\n",
Expand Down Expand Up @@ -312,8 +312,8 @@
}
],
"source": [
"!pip install just-agents-core==0.4.3\n",
"!pip install just-agents-examples==0.4.3"
"!pip install just-agents-core==0.4.5\n",
"!pip install just-agents-examples==0.4.5"
]
},
{
Expand Down
6 changes: 3 additions & 3 deletions examples/notebooks/03_coding_agent.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
"Requirement already satisfied: anyio<5,>=3.5.0 in /usr/local/lib/python3.10/dist-packages (from openai>=1.54.0->litellm>=1.51.0->just-agents) (3.7.1)\n",
"Requirement already satisfied: distro<2,>=1.7.0 in /usr/local/lib/python3.10/dist-packages (from openai>=1.54.0->litellm>=1.51.0->just-agents) (1.9.0)\n",
"Requirement already satisfied: httpx<1,>=0.23.0 in /usr/local/lib/python3.10/dist-packages (from openai>=1.54.0->litellm>=1.51.0->just-agents) (0.27.2)\n",
"Requirement already satisfied: jiter<1,>=0.4.3 in /usr/local/lib/python3.10/dist-packages (from openai>=1.54.0->litellm>=1.51.0->just-agents) (0.7.1)\n",
"Requirement already satisfied: jiter<1,>=0.4.5 in /usr/local/lib/python3.10/dist-packages (from openai>=1.54.0->litellm>=1.51.0->just-agents) (0.7.1)\n",
"Requirement already satisfied: sniffio in /usr/local/lib/python3.10/dist-packages (from openai>=1.54.0->litellm>=1.51.0->just-agents) (1.3.1)\n",
"Requirement already satisfied: tqdm>4 in /usr/local/lib/python3.10/dist-packages (from openai>=1.54.0->litellm>=1.51.0->just-agents) (4.66.6)\n",
"Requirement already satisfied: annotated-types>=0.6.0 in /usr/local/lib/python3.10/dist-packages (from pydantic<3.0.0,>=2.0.0->litellm>=1.51.0->just-agents) (0.7.0)\n",
Expand Down Expand Up @@ -156,8 +156,8 @@
}
],
"source": [
"!pip install just-agents-core==0.4.3\n",
"!pip install just-agents-examples==0.4.3"
"!pip install just-agents-core==0.4.5\n",
"!pip install just-agents-examples==0.4.5"
]
},
{
Expand Down
12 changes: 6 additions & 6 deletions examples/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "just-agents-examples"
version = "0.4.4"
version = "0.4.5"
description = "Just Agents - Examples code"
authors = ["Alex Karmazin <karmazinalex@gmail.com>"]
maintainers = ["Anton Kulaga <antonkulaga@gmail.com>"]
Expand All @@ -12,11 +12,11 @@ license = "MIT"

[tool.poetry.dependencies]
python = ">=3.10,<4.0"
just-agents-core = ">=0.4.3"
just-agents-tools = ">=0.4.3"
just-agents-coding = ">=0.4.3"
just-agents-web = ">=0.4.3"
just-agents-router = ">=0.4.3"
just-agents-core = ">=0.4.5"
just-agents-tools = ">=0.4.5"
just-agents-coding = ">=0.4.5"
just-agents-web = ">=0.4.5"
just-agents-router = ">=0.4.5"

[tool.poetry.group.dev.dependencies]
pytest = "^7.4.4"
Expand Down
1 change: 1 addition & 0 deletions just_agents/meta/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#placeholder for namespace package
Loading

0 comments on commit 7a03773

Please sign in to comment.