shaman-ai / agent-actors Goto Github PK
View Code? Open in Web Editor NEWHome Page: https://twitter.com/shaman_ai
License: GNU Lesser General Public License v3.0
Home Page: https://twitter.com/shaman_ai
License: GNU Lesser General Public License v3.0
It seems to me the parent/child relationship isn't really serving a purpose.
Would removing that relationship and simply dealing with them as 'workers' that can have descendants and know if they are descendant, be clearer and remove unnecessary complexity?
Everytime I run the test file, at the end of the first test (I suppose) I think there are issues with ray, I get this error:
FAILED agent_actors/test_system.py::TestSystem::test_parent_overhead - ray.exceptions.RayTaskError(TypeError): ray::AgentActor.run() (pid=23184, ip=127.0.0.1, repr=<agent_actors.actors.AgentActor object at 0x0000025CF0E45660>)
Here is the entire log:
self = <agent_actors.test_system.TestSystem object at 0x000002E43B6D36A0>
def test_parent_overhead(self):
luke = self.create_parent(
name="Luke",
traits=["project manager", "golden retriever energy"],
max_iterations=3,
)
amir = self.create_child(
name="Amir",
traits=["smart", "kind"],
max_iterations=3,
)
luke.children = {0: amir}
> luke.run(task="What is Sergey Brin's age multiplied by 12?")
agent_actors\test_system.py:100:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
agent_actors\parent.py:105: in run
results = ray.get(tasks_completed)
C:\Users\finbi\anaconda3\envs\py3912\lib\site-packages\ray\_private\client_mode_hook.py:105: in wrapper
return func(*args, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
object_refs = [ObjectRef(32d950ec0ccf9d2a5f96a25e5338223a08ab16470100000001000000), ObjectRef(e0dc174c835990345f96a25e5338223a08ab16470100000001000000), ObjectRef(f4402ec78d3a26075f96a25e5338223a08ab16470100000001000000)]
@PublicAPI
@client_mode_hook(auto_init=True)
def get(
object_refs: Union[ray.ObjectRef, Sequence[ray.ObjectRef]],
*,
timeout: Optional[float] = None,
) -> Union[Any, List[Any]]:
"""Get a remote object or a list of remote objects from the object store.
This method blocks until the object corresponding to the object ref is
available in the local object store. If this object is not in the local
object store, it will be shipped from an object store that has it (once the
object has been created). If object_refs is a list, then the objects
corresponding to each object in the list will be returned.
Ordering for an input list of object refs is preserved for each object
returned. That is, if an object ref to A precedes an object ref to B in the
input list, then A will precede B in the returned list.
This method will issue a warning if it's running inside async context,
you can use ``await object_ref`` instead of ``ray.get(object_ref)``. For
a list of object refs, you can use ``await asyncio.gather(*object_refs)``.
Related patterns and anti-patterns:
- :doc:`/ray-core/patterns/ray-get-loop`
- :doc:`/ray-core/patterns/unnecessary-ray-get`
- :doc:`/ray-core/patterns/ray-get-submission-order`
- :doc:`/ray-core/patterns/ray-get-too-many-objects`
Args:
object_refs: Object ref of the object to get or a list of object refs
to get.
timeout (Optional[float]): The maximum amount of time in seconds to
wait before returning. Set this to None will block until the
corresponding object becomes available.
WARNING: In future ray releases ``timeout=0`` will return the object
immediately if it's available, else raise GetTimeoutError in accordance with
the above docstring. The current behavior of blocking until objects become
available of ``timeout=0`` is considered to be a bug, see
https://github.com/ray-project/ray/issues/28465.
Returns:
A Python object or a list of Python objects.
Raises:
GetTimeoutError: A GetTimeoutError is raised if a timeout is set and
the get takes longer than timeout to return.
Exception: An exception is raised if the task that created the object
or that created one of the objects raised an exception.
"""
if timeout == 0:
if os.environ.get("RAY_WARN_RAY_GET_TIMEOUT_ZERO", "1") == "1":
import warnings
warnings.warn(
(
"Please use timeout=None if you expect ray.get() to block. "
"Setting timeout=0 in future ray releases will raise "
"GetTimeoutError if the objects references are not available. "
"You could suppress this warning by setting "
"RAY_WARN_RAY_GET_TIMEOUT_ZERO=0."
),
UserWarning,
)
# Record this usage in telemetry
import ray._private.usage.usage_lib as usage_lib
usage_lib.record_extra_usage_tag(usage_lib.TagKey.RAY_GET_TIMEOUT_ZERO, "True")
worker = global_worker
worker.check_connected()
if hasattr(worker, "core_worker") and worker.core_worker.current_actor_is_asyncio():
global blocking_get_inside_async_warned
if not blocking_get_inside_async_warned:
logger.warning(
"Using blocking ray.get inside async actor. "
"This blocks the event loop. Please use `await` "
"on object ref with asyncio.gather if you want to "
"yield execution to the event loop instead."
)
blocking_get_inside_async_warned = True
with profiling.profile("ray.get"):
is_individual_id = isinstance(object_refs, ray.ObjectRef)
if is_individual_id:
object_refs = [object_refs]
if not isinstance(object_refs, list):
raise ValueError(
"'object_refs' must either be an ObjectRef or a list of ObjectRefs."
)
# TODO(ujvl): Consider how to allow user to retrieve the ready objects.
values, debugger_breakpoint = worker.get_objects(object_refs, timeout=timeout)
for i, value in enumerate(values):
if isinstance(value, RayError):
if isinstance(value, ray.exceptions.ObjectLostError):
worker.core_worker.dump_object_store_memory_usage()
if isinstance(value, RayTaskError):
> raise value.as_instanceof_cause()
E ray.exceptions.RayTaskError(TypeError): ray::AgentActor.run() (pid=23184, ip=127.0.0.1, repr=<agent_actors.actors.AgentActor object at 0x0000025CF0E45660>)
E File "python\ray\_raylet.pyx", line 857, in ray._raylet.execute_task
E File "python\ray\_raylet.pyx", line 861, in ray._raylet.execute_task
E File "python\ray\_raylet.pyx", line 803, in ray._raylet.execute_task.function_executor
E File "C:\Users\finbi\anaconda3\envs\py3912\lib\site-packages\ray\_private\function_manager.py", line 674, in actor_method_executor
E return method(__ray_actor, *args, **kwargs)
E File "C:\Users\finbi\anaconda3\envs\py3912\lib\site-packages\ray\util\tracing\tracing_helper.py", line 466, in _resume_span
E return method(self, *_args, **_kwargs)
E File "C:\Users\finbi\pymaindir\aagi\Agents\la_multiagents\agent-actors\agent_actors\actors.py", line 12, in run
E return self.agent.run(*args, **kwargs)
E File "C:\Users\finbi\pymaindir\aagi\Agents\la_multiagents\agent-actors\agent_actors\child.py", line 49, in run
E self.add_memory(learning)
E File "C:\Users\finbi\pymaindir\aagi\Agents\la_multiagents\agent-actors\agent_actors\agent.py", line 150, in add_memory
E self.pause_to_reflect()
E File "C:\Users\finbi\pymaindir\aagi\Agents\la_multiagents\agent-actors\agent_actors\agent.py", line 240, in pause_to_reflect
E insights = self._pause_to_reflect()
E File "C:\Users\finbi\pymaindir\aagi\Agents\la_multiagents\agent-actors\agent_actors\agent.py", line 247, in _pause_to_reflect
E new_insights = self._synthesize_memories()
E File "C:\Users\finbi\pymaindir\aagi\Agents\la_multiagents\agent-actors\agent_actors\agent.py", line 207, in _synthesize_memories
E return self.synthesis(
E TypeError: Chain.__call__() got an unexpected keyword argument 'context'
C:\Users\finbi\anaconda3\envs\py3912\lib\site-packages\ray\_private\worker.py:2380: RayTaskError(TypeError)
should I resumate my old linux machine? wouuld that fix it?
Error while running pytest on test_system.py:
ERROR collecting test_system.py ____________________________________
......\AppData\Local\Programs\Python\Python311\Lib\site-packages_pytest\runner.py:341: in from_call
result: Optional[TResult] = func()
......\AppData\Local\Programs\Python\Python311\Lib\site-packages_pytest\runner.py:372: in
call = CallInfo.from_call(lambda: list(collector.collect()), "collect")
......\AppData\Local\Programs\Python\Python311\Lib\site-packages_pytest\python.py:531: in collect
self._inject_setup_module_fixture()
......\AppData\Local\Programs\Python\Python311\Lib\site-packages_pytest\python.py:545: in _inject_setup_module_fixture
self.obj, ("setUpModule", "setup_module")
......\AppData\Local\Programs\Python\Python311\Lib\site-packages_pytest\python.py:310: in obj
self._obj = obj = self._getobj()
......\AppData\Local\Programs\Python\Python311\Lib\site-packages_pytest\python.py:528: in _getobj
return self._importtestmodule()
......\AppData\Local\Programs\Python\Python311\Lib\site-packages_pytest\python.py:617: in importtestmodule
mod = import_path(self.path, mode=importmode, root=self.config.rootpath)
......\AppData\Local\Programs\Python\Python311\Lib\site-packages_pytest\pathlib.py:565: in import_path importlib.import_module(module_name)
......\AppData\Local\Programs\Python\Python311\Lib\importlib_init.py:126: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
:1204: in _gcd_import
???
:1176: in _find_and_load
???
:1126: in _find_and_load_unlocked
???
:241: in call_with_frames_removed
???
:1204: in gcd_import
???
:1176: in find_and_load
???
:1147: in find_and_load_unlocked
???
:690: in load_unlocked
???
:940: in exec_module
???
:241: in call_with_frames_removed
???
init.py:2: in
from agent_actors.agent import Agent
agent.py:7: in
from langchain import LLMChain
......\AppData\Local\Programs\Python\Python311\Lib\site-packages\langchain_init.py:6: in
from langchain.agents import MRKLChain, ReActChain, SelfAskWithSearchChain
......\AppData\Local\Programs\Python\Python311\Lib\site-packages\langchain\agents_init.py:2: in
from langchain.agents.agent import (
......\AppData\Local\Programs\Python\Python311\Lib\site-packages\langchain\agents\agent.py:16: in
from langchain.agents.tools import InvalidTool
......\AppData\Local\Programs\Python\Python311\Lib\site-packages\langchain\agents\tools.py:8: in
from langchain.tools.base import BaseTool, Tool, tool
......\AppData\Local\Programs\Python\Python311\Lib\site-packages\langchain\tools_init.py:32: in
from langchain.tools.openapi.utils.api_models import APIOperation
......\AppData\Local\Programs\Python\Python311\Lib\site-packages\langchain\tools\openapi\utils\api_models.py:6: in
from openapi_schema_pydantic import MediaType, Parameter, Reference, RequestBody, Schema
......\AppData\Local\Programs\Python\Python311\Lib\site-packages\openapi_schema_pydantic_init.py:3: in
from .v3 import *
......\AppData\Local\Programs\Python\Python311\Lib\site-packages\openapi_schema_pydantic\v3_init.py:1: in
from .v3_1_0 import *
......\AppData\Local\Programs\Python\Python311\Lib\site-packages\openapi_schema_pydantic\v3\v3_1_0_init.py:9: in
from .open_api import OpenAPI
......\AppData\Local\Programs\Python\Python311\Lib\site-packages\openapi_schema_pydantic\v3\v3_1_0\open_api.py:5: in
from .components import Components
......\AppData\Local\Programs\Python\Python311\Lib\site-packages\openapi_schema_pydantic\v3\v3_1_0\components.py:7: in
from .header import Header
......\AppData\Local\Programs\Python\Python311\Lib\site-packages\openapi_schema_pydantic\v3\v3_1_0\header.py:3: in
from .parameter import Parameter
......\AppData\Local\Programs\Python\Python311\Lib\site-packages\openapi_schema_pydantic\v3\v3_1_0\parameter.py:6: in
from .media_type import MediaType
......\AppData\Local\Programs\Python\Python311\Lib\site-packages\openapi_schema_pydantic\v3\v3_1_0\media_type.py:8: in
from .schema import Schema
......\AppData\Local\Programs\Python\Python311\Lib\site-packages\openapi_schema_pydantic\v3\v3_1_0\schema.py:10: in
class Schema(BaseModel):
......\AppData\Local\Programs\Python\Python311\Lib\site-packages\pydantic\main.py:291: in new
cls.signature = ClassAttribute('signature', generate_model_signature(cls.init, fields, config))
......\AppData\Local\Programs\Python\Python311\Lib\site-packages\pydantic\utils.py:256: in generate_model_signature
merged_params[param_name] = Parameter(
......\AppData\Local\Programs\Python\Python311\Lib\inspect.py:2725: in init
raise ValueError('{!r} is not a valid parameter name'.format(name))
E ValueError: 'not' is not a valid parameter name
from agent_actors.callback_manager import ConsolePrettyPrintManager
ModuleNotFoundError: No module named 'agent_actors'
It looks like you are trying to import a folder from within that folder?
On Windows 11 I've setup a specific conda environment with python 3.10.9 cuz every pipenv installation would fail with that error. Tried with multiple python versions, but I still get that error even though my python version is now exactly Python 3.10.9. On the other hand can't use poetry as the installation fails due to the impossibility of installing ray. Any help would be much appreciated. Python 3.11.3, for instance, would throw the same error, so would python 3.9.16.
Unable to install anymore on Windows, several failures, maybe I’m missing something, here’s the process I follow:
git clone https://github.com/shaman-ai/agent-actors.git
if I don’t do this I cannot run:
poetry add git+https://github.com/shaman-ai/agent-actors.git
Which looks for the .toml and throws an error.
So I clone, run:
cd agent-actors
run:
poetry add git+https://github.com/shaman-ai/agent-actors.git
and get this error:
Package 'agent-actors' is listed as a dependency of itself.
When running befrore recloning I got errors in:
poetry install --with dev --with typing
but can’t even get there anymore.
Could you please try the whole setup in a new directory from scratch and see if there are issues? Your proof of concept is extremely interesting, but I can’t make it work anymore.
When trying to install via pipenv on Windows I get:
Loading .env environment variables...
Installing git+https://github.com/shaman-ai/agent-actors.git#egg=agent-actors...
Resolving git+https://github.com/shaman-ai/agent-actors.git#egg=agent-actors...
Installing...
[ ] Installing agent-actors...[31m[1mError: [0m An error occurred while installing [32mgit+https://github.com/shaman-ai/agent-actors.git#egg=agent-actors[0m!
Error text: Collecting agent-actors (from -r c:\users\finbi\appdata\local\temp\pipenv-mb2k0hrk-requirements\pipenv-jpnwji4g-requirement.txt (line 1))
Cloning https://github.com/shaman-ai/agent-actors.git to c:\users\finbi\appdata\local\temp\pip-install-oms8w0i0\agent-actors_2edcb81a7c2a4d6988dd6c92554d11e1
Resolved https://github.com/shaman-ai/agent-actors.git to commit 9bb3690a8adeff3501ceef10b3659046376e2ac2
Installing build dependencies: started
Installing build dependencies: finished with status 'done'
Getting requirements to build wheel: started
Getting requirements to build wheel: finished with status 'done'
Preparing metadata (pyproject.toml): started
Preparing metadata (pyproject.toml): finished with status 'done'
Collecting langchain@ git+https://github.com/hwchase17/langchain.git@master (from agent-actors->-r c:\users\finbi\appdata\local\temp\pipenv-mb2k0hrk-requirements\pipenv-jpnwji4g-requirement.txt
(line 1))
Cloning https://github.com/hwchase17/langchain.git (to revision master) to c:\users\finbi\appdata\local\temp\pip-install-oms8w0i0\langchain_64424163946e4fb39dff885c90088326
Resolved https://github.com/hwchase17/langchain.git to commit 3bd5a99b835fa320d02aa733cb0c0bc4a87724fa
Installing build dependencies: started
Installing build dependencies: finished with status 'done'
Getting requirements to build wheel: started
Getting requirements to build wheel: finished with status 'done'
Preparing metadata (pyproject.toml): started
Preparing metadata (pyproject.toml): finished with status 'done'
Collecting aiohttp<4.0.0,>=3.8.4 (from agent-actors->-r c:\users\finbi\appdata\local\temp\pipenv-mb2k0hrk-requirements\pipenv-jpnwji4g-requirement.txt (line 1))
Using cached aiohttp-3.8.4-cp39-cp39-win_amd64.whl (323 kB)
Collecting gptcache<0.2.0,>=0.1.17 (from agent-actors->-r c:\users\finbi\appdata\local\temp\pipenv-mb2k0hrk-requirements\pipenv-jpnwji4g-requirement.txt (line 1))
Using cached gptcache-0.1.21-py3-none-any.whl (79 kB)
Collecting openai<0.28.0,>=0.27.4 (from agent-actors->-r c:\users\finbi\appdata\local\temp\pipenv-mb2k0hrk-requirements\pipenv-jpnwji4g-requirement.txt (line 1))
Downloading openai-0.27.6-py3-none-any.whl (71 kB)
---------------------------------------- 71.9/71.9 kB 1.9 MB/s eta 0:00:00
Collecting pydantic<2.0.0,>=1.10.7 (from agent-actors->-r c:\users\finbi\appdata\local\temp\pipenv-mb2k0hrk-requirements\pipenv-jpnwji4g-requirement.txt (line 1))
Using cached pydantic-1.10.7-cp39-cp39-win_amd64.whl (2.2 MB)
Collecting python-dotenv<2.0.0,>=1.0.0 (from agent-actors->-r c:\users\finbi\appdata\local\temp\pipenv-mb2k0hrk-requirements\pipenv-jpnwji4g-requirement.txt (line 1))
Using cached python_dotenv-1.0.0-py3-none-any.whl (19 kB)
Collecting ray<3.0.0,>=2.3.1 (from agent-actors->-r c:\users\finbi\appdata\local\temp\pipenv-mb2k0hrk-requirements\pipenv-jpnwji4g-requirement.txt (line 1))
Using cached ray-2.4.0-cp39-cp39-win_amd64.whl (21.7 MB)
Collecting termcolor<3.0.0,>=2.2.0 (from agent-actors->-r c:\users\finbi\appdata\local\temp\pipenv-mb2k0hrk-requirements\pipenv-jpnwji4g-requirement.txt (line 1))
Using cached termcolor-2.3.0-py3-none-any.whl (6.9 kB)
Collecting tiktoken<0.4.0,>=0.3.3 (from agent-actors->-r c:\users\finbi\appdata\local\temp\pipenv-mb2k0hrk-requirements\pipenv-jpnwji4g-requirement.txt (line 1))
Using cached tiktoken-0.3.3-cp39-cp39-win_amd64.whl (579 kB)
Collecting wikipedia<2.0.0,>=1.4.0 (from agent-actors->-r c:\users\finbi\appdata\local\temp\pipenv-mb2k0hrk-requirements\pipenv-jpnwji4g-requirement.txt (line 1))
Using cached wikipedia-1.4.0.tar.gz (27 kB)
Preparing metadata (setup.py): started
Preparing metadata (setup.py): finished with status 'done'
Collecting wolframalpha<6.0.0,>=5.0.0 (from agent-actors->-r c:\users\finbi\appdata\local\temp\pipenv-mb2k0hrk-requirements\pipenv-jpnwji4g-requirement.txt (line 1))
Using cached wolframalpha-5.0.0-py3-none-any.whl (7.5 kB)
INFO: pip is looking at multiple versions of agent-actors to determine which version is compatible with other requirements. This could take a while.
[ =] Installing agent-actors...[36m Running command git clone --filter=blob:none --quiet https://github.com/shaman-ai/agent-actors.git
'C:\Users\finbi\AppData\Local\Temp\pip-install-oms8w0i0\agent-actors_2edcb81a7c2a4d6988dd6c92554d11e1'
Running command git clone --filter=blob:none --quiet https://github.com/hwchase17/langchain.git
'C:\Users\finbi\AppData\Local\Temp\pip-install-oms8w0i0\langchain_64424163946e4fb39dff885c90088326'
ERROR: Package 'agent-actors' requires a different Python: 3.9.12 not in '<4.0.0,>=3.10.9'
[0m
Installation Failed
But I’m running python 3.10.9
When trying pipenv on Ubuntu I get:
Resolving dependencies...
✘ Locking Failed!
⠇ Locking...
Traceback (most recent call last):
File "/home/luca/anaconda3/envs/py310/lib/python3.10/site-packages/pipenv/resolver.py", line 845, in <module>
main()
File "/home/luca/anaconda3/envs/py310/lib/python3.10/site-packages/pipenv/resolver.py", line 831, in main
_main(
File "/home/luca/anaconda3/envs/py310/lib/python3.10/site-packages/pipenv/resolver.py", line 811, in _main
resolve_packages(
File "/home/luca/anaconda3/envs/py310/lib/python3.10/site-packages/pipenv/resolver.py", line 759, in resolve_packages
results, resolver = resolve(
File "/home/luca/anaconda3/envs/py310/lib/python3.10/site-packages/pipenv/resolver.py", line 738, in resolve
return resolve_deps(
File "/home/luca/anaconda3/envs/py310/lib/python3.10/site-packages/pipenv/utils/resolver.py", line 1096, in resolve_deps
results, hashes, markers_lookup, resolver, skipped = actually_resolve_deps(
File "/home/luca/anaconda3/envs/py310/lib/python3.10/site-packages/pipenv/utils/resolver.py", line 884, in actually_resolve_deps
resolver = Resolver.create(
File "/home/luca/anaconda3/envs/py310/lib/python3.10/site-packages/pipenv/utils/resolver.py", line 455, in create
constraints, skipped, index_lookup, markers_lookup = resolver.get_metadata(
File "/home/luca/anaconda3/envs/py310/lib/python3.10/site-packages/pipenv/utils/resolver.py", line 245, in get_metadata
constraint_update, lockfile_update = self.get_deps_from_req(
File "/home/luca/anaconda3/envs/py310/lib/python3.10/site-packages/pipenv/utils/resolver.py", line 361, in get_deps_from_req
new_constraints, new_lock = self.get_deps_from_req(
File "/home/luca/anaconda3/envs/py310/lib/python3.10/site-packages/pipenv/utils/resolver.py", line 367, in get_deps_from_req
elif r and (not r.marker or (r.marker and r.marker.evaluate())):
File "/home/luca/anaconda3/envs/py310/lib/python3.10/site-packages/pipenv/patched/pip/_vendor/packaging/markers.py", line 304, in evaluate
return _evaluate_markers(self._markers, current_environment)
File "/home/luca/anaconda3/envs/py310/lib/python3.10/site-packages/pipenv/patched/pip/_vendor/packaging/markers.py", line 229, in _evaluate_markers
groups[-1].append(_evaluate_markers(marker, environment))
File "/home/luca/anaconda3/envs/py310/lib/python3.10/site-packages/pipenv/patched/pip/_vendor/packaging/markers.py", line 234, in _evaluate_markers
lhs_value = _get_env(environment, lhs.value)
File "/home/luca/anaconda3/envs/py310/lib/python3.10/site-packages/pipenv/patched/pip/_vendor/packaging/markers.py", line 215, in _get_env
raise UndefinedEnvironmentName(
pipenv.patched.pip._vendor.packaging.markers.UndefinedEnvironmentName: 'extra' does not exist in evaluation environment.
(py310) luca@luca-UX31E:~/py_conda/agents/agent-actors$ pipenv install git+https://github.com/shaman-ai/agent-actors.git#egg=agent-actors
Installing git+https://github.com/shaman-ai/agent-actors.git#egg=agent-actors...
Resolving git+https://github.com/shaman-ai/agent-actors.git#egg=agent-actors...
Installing...
Adding agent-actors to Pipfile's [packages] ...
✔ Installation Succeeded
Pipfile.lock not found, creating...
Locking [packages] dependencies...
Building requirements...
Resolving dependencies...
✘ Locking Failed!
⠋ Locking...
Traceback (most recent call last):
File "/home/luca/anaconda3/envs/py310/lib/python3.10/site-packages/pipenv/resolver.py", line 845, in <module>
main()
File "/home/luca/anaconda3/envs/py310/lib/python3.10/site-packages/pipenv/resolver.py", line 831, in main
_main(
File "/home/luca/anaconda3/envs/py310/lib/python3.10/site-packages/pipenv/resolver.py", line 811, in _main
resolve_packages(
File "/home/luca/anaconda3/envs/py310/lib/python3.10/site-packages/pipenv/resolver.py", line 759, in resolve_packages
results, resolver = resolve(
File "/home/luca/anaconda3/envs/py310/lib/python3.10/site-packages/pipenv/resolver.py", line 738, in resolve
return resolve_deps(
File "/home/luca/anaconda3/envs/py310/lib/python3.10/site-packages/pipenv/utils/resolver.py", line 1096, in resolve_deps
results, hashes, markers_lookup, resolver, skipped = actually_resolve_deps(
File "/home/luca/anaconda3/envs/py310/lib/python3.10/site-packages/pipenv/utils/resolver.py", line 884, in actually_resolve_deps
resolver = Resolver.create(
File "/home/luca/anaconda3/envs/py310/lib/python3.10/site-packages/pipenv/utils/resolver.py", line 455, in create
constraints, skipped, index_lookup, markers_lookup = resolver.get_metadata(
File "/home/luca/anaconda3/envs/py310/lib/python3.10/site-packages/pipenv/utils/resolver.py", line 245, in get_metadata
constraint_update, lockfile_update = self.get_deps_from_req(
File "/home/luca/anaconda3/envs/py310/lib/python3.10/site-packages/pipenv/utils/resolver.py", line 361, in get_deps_from_req
new_constraints, new_lock = self.get_deps_from_req(
File "/home/luca/anaconda3/envs/py310/lib/python3.10/site-packages/pipenv/utils/resolver.py", line 367, in get_deps_from_req
elif r and (not r.marker or (r.marker and r.marker.evaluate())):
File "/home/luca/anaconda3/envs/py310/lib/python3.10/site-packages/pipenv/patched/pip/_vendor/packaging/markers.py", line 304, in evaluate
return _evaluate_markers(self._markers, current_environment)
File "/home/luca/anaconda3/envs/py310/lib/python3.10/site-packages/pipenv/patched/pip/_vendor/packaging/markers.py", line 229, in _evaluate_markers
groups[-1].append(_evaluate_markers(marker, environment))
File "/home/luca/anaconda3/envs/py310/lib/python3.10/site-packages/pipenv/patched/pip/_vendor/packaging/markers.py", line 234, in _evaluate_markers
lhs_value = _get_env(environment, lhs.value)
File "/home/luca/anaconda3/envs/py310/lib/python3.10/site-packages/pipenv/patched/pip/_vendor/packaging/markers.py", line 215, in _get_env
raise UndefinedEnvironmentName(
pipenv.patched.pip._vendor.packaging.markers.UndefinedEnvironmentName: 'extra' does not exist in evaluation environment.
Any idea what could be the issue here?
File "/home/ehazar/miniconda3/envs/mma/lib/python3.10/site-packages/agent_actors/parent.py", line 104, in run
results = ray.get(tasks_completed)
File "/home/ehazar/miniconda3/envs/mma/lib/python3.10/site-packages/ray/_private/client_mode_hook.py", line 105, in wrapper
return func(*args, **kwargs)
File "/home/ehazar/miniconda3/envs/mma/lib/python3.10/site-packages/ray/_private/worker.py", line 2521, in get
raise value.as_instanceof_cause()
ray.exceptions.RayTaskError(KeyError): ray::AgentActor.run() (pid=21229, ip=10.120.210.89, repr=<agent_actors.actors.AgentActor object at 0x7f81e4e6d7b0>)
File "/home/ehazar/miniconda3/envs/mma/lib/python3.10/site-packages/agent_actors/actors.py", line 12, in run
return self.agent.run(*args, **kwargs)
File "/home/ehazar/miniconda3/envs/mma/lib/python3.10/site-packages/agent_actors/parent.py", line 91, in run
working_memory=[
File "/home/ehazar/miniconda3/envs/mma/lib/python3.10/site-packages/agent_actors/parent.py", line 92, in <listcomp>
task_result_refs[d.id] for d in sub_task.dependencies
KeyError: '4.4'
After a seriously painful installation process both in anaconda ubuntu and anaconda windows I'm afraid we falled for the ever changing, uber complex langchain machinery, i get these errors both on windows and linux:
_________________________________________ ERROR collecting test_system.py _________________________________________
ImportError while importing test module 'C:\Users\finbi\pymaindir\la_multiagents\aa2\agent-actors\agent_actors\test_system.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
C:\Users\finbi\anaconda3\envs\actn\lib\importlib\__init__.py:126: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
__init__.py:3: in <module>
from agent_actors.callback_manager import (
callback_manager.py:4: in <module>
from langchain.callbacks import CallbackManager, StdOutCallbackHandler
E ImportError: cannot import name 'CallbackManager' from 'langchain.callbacks' (C:\Users\finbi\anaconda3\envs\actn\lib\site-packages\langchain\callbacks\__init__.py)
____________________________ ERROR collecting agent-actors/agent_actors/test_system.py ____________________________
ImportError while importing test module 'C:\Users\finbi\pymaindir\la_multiagents\aa2\agent-actors\agent_actors\agent-actors\agent_actors\test_system.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
C:\Users\finbi\anaconda3\envs\actn\lib\importlib\__init__.py:126: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
agent-actors\agent_actors\__init__.py:3: in <module>
from agent_actors.callback_manager import (
agent-actors\agent_actors\callback_manager.py:4: in <module>
from langchain.callbacks import CallbackManager, StdOutCallbackHandler
E ImportError: cannot import name 'CallbackManager' from 'langchain.callbacks' (C:\Users\finbi\anaconda3\envs\actn\lib\site-packages\langchain\callbacks\__init__.py)
Been feverishly waiting for an unpdate as the previous release was plagued by JSON parsing errors in parent.py (couldn't finish a single run without some and that is as well a langchain issue AFAIK) but here we are.
In Ubuntu, python 3.10, installation method poetry (the only combo which worked for me) when running test I get this using the latest commit:
========================================================================= FAILURES ==========================================================================
______________________________________________________________ TestSystem.test_parent_overhead ______________________________________________________________
self = <agent_actors.test_system.TestSystem object at 0x7f165626a770>
def test_parent_overhead(self):
luke = self.create_parent(
name="Luke",
traits=["project manager", "golden retriever energy"],
max_iterations=3,
)
amir = self.create_child(
name="Amir",
traits=["smart", "kind"],
max_iterations=3,
)
luke.children = {0: amir}
> luke.run(task="What is Sergey Brin's age multiplied by 12?")
agent_actors/test_system.py:100:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
agent_actors/parent.py:109: in run
self.pause_to_reflect()
agent_actors/agent.py:240: in pause_to_reflect
insights = self._pause_to_reflect()
agent_actors/agent.py:247: in _pause_to_reflect
new_insights = self._synthesize_memories()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = ParentAgent(name='Luke', traits=['project manager', 'golden retriever energy'], tools=[], task='', children={0: ChildA...penai_organization=None, request_timeout=60, max_retries=6, streaming=False, n=1, max_tokens=1024), output_key='json'))
last_k = 10
def _synthesize_memories(
self, last_k: Optional[int] = None
) -> Tuple[str, str, str]:
if last_k is None:
last_k = self.reflect_every
observations = self.long_term_memory.memory_stream[-last_k:]
if not any(observations):
return []
> return self.synthesis(
context=self.get_header(),
task=self.task,
memories="\n".join(o.page_content for o in observations),
)["items"]
E TypeError: Chain.__call__() got an unexpected keyword argument 'context'
agent_actors/agent.py:207: TypeError
____________________________________________________________ TestSystem.test_parallel_map_reduce ____________________________________________________________
self = <agent_actors.test_system.TestSystem object at 0x7f1656269030>
def test_parallel_map_reduce(self):
jiang = self.create_child(
name="Jiang",
traits=["sharp", "math, stats, and data whiz", "capitalist"],
)
sophia = self.create_child(
name="Sophia",
traits=["deep thinker", "contrarian", "empathetic"],
)
esther = self.create_child(
name="Esther",
traits=["great writer"],
)
jerry = self.create_child(
name="Jerry",
traits=["funny", "creative", "comedian", "executive assistant"],
)
luke = self.create_parent(
name="Luke",
traits=["AI project manager", "golden retriever energy"],
max_iterations=3,
children={0: jiang, 1: sophia, 2: esther, 42: jerry},
)
> luke.run(
task="I need an executive report on Artificial General Intelligence and a list of 5 relevant jokes and quotes."
)
agent_actors/test_system.py:125:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
agent_actors/parent.py:104: in run
results = ray.get(tasks_completed)
../../../anaconda3/envs/py310/lib/python3.10/site-packages/ray/_private/client_mode_hook.py:105: in wrapper
return func(*args, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
object_refs = [ObjectRef(359ec6ce30d3ca2d3902a25e82292a7ee269b87d0100000001000000), ObjectRef(1e8ff6d2361327843e7e1bf192eab8a5c7efcd...48dba956f36448630ff755534ffda1140100000001000000), ObjectRef(71b133a11e1c461cf36448630ff755534ffda1140100000001000000)]
@PublicAPI
@client_mode_hook(auto_init=True)
def get(
object_refs: Union[ray.ObjectRef, Sequence[ray.ObjectRef]],
*,
timeout: Optional[float] = None,
) -> Union[Any, List[Any]]:
"""Get a remote object or a list of remote objects from the object store.
This method blocks until the object corresponding to the object ref is
available in the local object store. If this object is not in the local
object store, it will be shipped from an object store that has it (once the
object has been created). If object_refs is a list, then the objects
corresponding to each object in the list will be returned.
Ordering for an input list of object refs is preserved for each object
returned. That is, if an object ref to A precedes an object ref to B in the
input list, then A will precede B in the returned list.
This method will issue a warning if it's running inside async context,
you can use ``await object_ref`` instead of ``ray.get(object_ref)``. For
a list of object refs, you can use ``await asyncio.gather(*object_refs)``.
Related patterns and anti-patterns:
- :doc:`/ray-core/patterns/ray-get-loop`
- :doc:`/ray-core/patterns/unnecessary-ray-get`
- :doc:`/ray-core/patterns/ray-get-submission-order`
- :doc:`/ray-core/patterns/ray-get-too-many-objects`
Args:
object_refs: Object ref of the object to get or a list of object refs
to get.
timeout (Optional[float]): The maximum amount of time in seconds to
wait before returning. Set this to None will block until the
corresponding object becomes available.
WARNING: In future ray releases ``timeout=0`` will return the object
immediately if it's available, else raise GetTimeoutError in accordance with
the above docstring. The current behavior of blocking until objects become
available of ``timeout=0`` is considered to be a bug, see
https://github.com/ray-project/ray/issues/28465.
Returns:
A Python object or a list of Python objects.
Raises:
GetTimeoutError: A GetTimeoutError is raised if a timeout is set and
the get takes longer than timeout to return.
Exception: An exception is raised if the task that created the object
or that created one of the objects raised an exception.
"""
if timeout == 0:
if os.environ.get("RAY_WARN_RAY_GET_TIMEOUT_ZERO", "1") == "1":
import warnings
warnings.warn(
(
"Please use timeout=None if you expect ray.get() to block. "
"Setting timeout=0 in future ray releases will raise "
"GetTimeoutError if the objects references are not available. "
"You could suppress this warning by setting "
"RAY_WARN_RAY_GET_TIMEOUT_ZERO=0."
),
UserWarning,
)
# Record this usage in telemetry
import ray._private.usage.usage_lib as usage_lib
usage_lib.record_extra_usage_tag(usage_lib.TagKey.RAY_GET_TIMEOUT_ZERO, "True")
worker = global_worker
worker.check_connected()
if hasattr(worker, "core_worker") and worker.core_worker.current_actor_is_asyncio():
global blocking_get_inside_async_warned
if not blocking_get_inside_async_warned:
logger.warning(
"Using blocking ray.get inside async actor. "
"This blocks the event loop. Please use `await` "
"on object ref with asyncio.gather if you want to "
"yield execution to the event loop instead."
)
blocking_get_inside_async_warned = True
with profiling.profile("ray.get"):
is_individual_id = isinstance(object_refs, ray.ObjectRef)
if is_individual_id:
object_refs = [object_refs]
if not isinstance(object_refs, list):
raise ValueError(
"'object_refs' must either be an ObjectRef or a list of ObjectRefs."
)
# TODO(ujvl): Consider how to allow user to retrieve the ready objects.
values, debugger_breakpoint = worker.get_objects(object_refs, timeout=timeout)
for i, value in enumerate(values):
if isinstance(value, RayError):
if isinstance(value, ray.exceptions.ObjectLostError):
worker.core_worker.dump_object_store_memory_usage()
if isinstance(value, RayTaskError):
> raise value.as_instanceof_cause()
E ray.exceptions.RayTaskError(TypeError): ray::AgentActor.run() (pid=28647, ip=192.168.1.71, repr=<agent_actors.actors.AgentActor object at 0x7f1a176f4fa0>)
E File "/home/luca/py_conda/agents/agent-actors/agent_actors/actors.py", line 12, in run
E return self.agent.run(*args, **kwargs)
E File "/home/luca/py_conda/agents/agent-actors/agent_actors/child.py", line 49, in run
E self.add_memory(learning)
E File "/home/luca/py_conda/agents/agent-actors/agent_actors/agent.py", line 150, in add_memory
E self.pause_to_reflect()
E File "/home/luca/py_conda/agents/agent-actors/agent_actors/agent.py", line 240, in pause_to_reflect
E insights = self._pause_to_reflect()
E File "/home/luca/py_conda/agents/agent-actors/agent_actors/agent.py", line 247, in _pause_to_reflect
E new_insights = self._synthesize_memories()
E File "/home/luca/py_conda/agents/agent-actors/agent_actors/agent.py", line 207, in _synthesize_memories
E return self.synthesis(
E TypeError: Chain.__call__() got an unexpected keyword argument 'context'
../../../anaconda3/envs/py310/lib/python3.10/site-packages/ray/_private/worker.py:2380: RayTaskError(TypeError)
____________________________________________________________ TestSystem.test_nested_parent_tree _____________________________________________________________
self = <agent_actors.test_system.TestSystem object at 0x7f165626b460>
def test_nested_parent_tree(self):
jiang = self.create_child(
name="Jiang",
traits=["sharp", "math, stats, and data whiz", "capitalist"],
)
sophia = self.create_child(
name="Sophia",
traits=["deep thinker", "contrarian", "empathetic"],
)
esther = self.create_child(
name="Esther",
traits=["great writer"],
)
luke = self.create_parent(
name="Luke",
traits=["AI project manager", "golden retriever energy"],
max_iterations=3,
children={0: jiang, 1: sophia, 2: esther},
)
amir = self.create_child(
name="Amir",
traits=["funny", "creative", "kind"],
)
cyrus = self.create_parent(
"Cyrus",
traits=["kind human"],
max_iterations=2,
children={0: luke, 42: amir},
)
> cyrus.run(
task="I need an executive report on Artificial General Intelligence and a list of 5 related jokes and quotes."
)
agent_actors/test_system.py:159:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
agent_actors/parent.py:104: in run
results = ray.get(tasks_completed)
../../../anaconda3/envs/py310/lib/python3.10/site-packages/ray/_private/client_mode_hook.py:105: in wrapper
return func(*args, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
object_refs = [ObjectRef(c76a79b2875a7251689a6d51e3a176933fee89c30100000001000000), ObjectRef(465c0fb8d6cb3cdce0ac6af40fc94d0a932242b10100000001000000)]
@PublicAPI
@client_mode_hook(auto_init=True)
def get(
object_refs: Union[ray.ObjectRef, Sequence[ray.ObjectRef]],
*,
timeout: Optional[float] = None,
) -> Union[Any, List[Any]]:
"""Get a remote object or a list of remote objects from the object store.
This method blocks until the object corresponding to the object ref is
available in the local object store. If this object is not in the local
object store, it will be shipped from an object store that has it (once the
object has been created). If object_refs is a list, then the objects
corresponding to each object in the list will be returned.
Ordering for an input list of object refs is preserved for each object
returned. That is, if an object ref to A precedes an object ref to B in the
input list, then A will precede B in the returned list.
This method will issue a warning if it's running inside async context,
you can use ``await object_ref`` instead of ``ray.get(object_ref)``. For
a list of object refs, you can use ``await asyncio.gather(*object_refs)``.
Related patterns and anti-patterns:
- :doc:`/ray-core/patterns/ray-get-loop`
- :doc:`/ray-core/patterns/unnecessary-ray-get`
- :doc:`/ray-core/patterns/ray-get-submission-order`
- :doc:`/ray-core/patterns/ray-get-too-many-objects`
Args:
object_refs: Object ref of the object to get or a list of object refs
to get.
timeout (Optional[float]): The maximum amount of time in seconds to
wait before returning. Set this to None will block until the
corresponding object becomes available.
WARNING: In future ray releases ``timeout=0`` will return the object
immediately if it's available, else raise GetTimeoutError in accordance with
the above docstring. The current behavior of blocking until objects become
available of ``timeout=0`` is considered to be a bug, see
https://github.com/ray-project/ray/issues/28465.
Returns:
A Python object or a list of Python objects.
Raises:
GetTimeoutError: A GetTimeoutError is raised if a timeout is set and
the get takes longer than timeout to return.
Exception: An exception is raised if the task that created the object
or that created one of the objects raised an exception.
"""
if timeout == 0:
if os.environ.get("RAY_WARN_RAY_GET_TIMEOUT_ZERO", "1") == "1":
import warnings
warnings.warn(
(
"Please use timeout=None if you expect ray.get() to block. "
"Setting timeout=0 in future ray releases will raise "
"GetTimeoutError if the objects references are not available. "
"You could suppress this warning by setting "
"RAY_WARN_RAY_GET_TIMEOUT_ZERO=0."
),
UserWarning,
)
# Record this usage in telemetry
import ray._private.usage.usage_lib as usage_lib
usage_lib.record_extra_usage_tag(usage_lib.TagKey.RAY_GET_TIMEOUT_ZERO, "True")
worker = global_worker
worker.check_connected()
if hasattr(worker, "core_worker") and worker.core_worker.current_actor_is_asyncio():
global blocking_get_inside_async_warned
if not blocking_get_inside_async_warned:
logger.warning(
"Using blocking ray.get inside async actor. "
"This blocks the event loop. Please use `await` "
"on object ref with asyncio.gather if you want to "
"yield execution to the event loop instead."
)
blocking_get_inside_async_warned = True
with profiling.profile("ray.get"):
is_individual_id = isinstance(object_refs, ray.ObjectRef)
if is_individual_id:
object_refs = [object_refs]
if not isinstance(object_refs, list):
raise ValueError(
"'object_refs' must either be an ObjectRef or a list of ObjectRefs."
)
# TODO(ujvl): Consider how to allow user to retrieve the ready objects.
values, debugger_breakpoint = worker.get_objects(object_refs, timeout=timeout)
for i, value in enumerate(values):
if isinstance(value, RayError):
if isinstance(value, ray.exceptions.ObjectLostError):
worker.core_worker.dump_object_store_memory_usage()
if isinstance(value, RayTaskError):
> raise value.as_instanceof_cause()
E ray.exceptions.RayTaskError(TypeError): ray::AgentActor.run() (pid=30284, ip=192.168.1.71, repr=<agent_actors.actors.AgentActor object at 0x7fa6d57a8eb0>)
E File "/home/luca/py_conda/agents/agent-actors/agent_actors/actors.py", line 12, in run
E return self.agent.run(*args, **kwargs)
E File "/home/luca/py_conda/agents/agent-actors/agent_actors/parent.py", line 104, in run
E results = ray.get(tasks_completed)
E ray.exceptions.RayTaskError(TypeError): ray::AgentActor.run() (pid=30283, ip=192.168.1.71, repr=<agent_actors.actors.AgentActor object at 0x7f959772cf70>)
E File "/home/luca/py_conda/agents/agent-actors/agent_actors/actors.py", line 12, in run
E return self.agent.run(*args, **kwargs)
E File "/home/luca/py_conda/agents/agent-actors/agent_actors/child.py", line 52, in run
E self.add_memory(learning)
E File "/home/luca/py_conda/agents/agent-actors/agent_actors/agent.py", line 150, in add_memory
E self.pause_to_reflect()
E File "/home/luca/py_conda/agents/agent-actors/agent_actors/agent.py", line 240, in pause_to_reflect
E insights = self._pause_to_reflect()
E File "/home/luca/py_conda/agents/agent-actors/agent_actors/agent.py", line 247, in _pause_to_reflect
E new_insights = self._synthesize_memories()
E File "/home/luca/py_conda/agents/agent-actors/agent_actors/agent.py", line 207, in _synthesize_memories
E return self.synthesis(
E TypeError: Chain.__call__() got an unexpected keyword argument 'context'
../../../anaconda3/envs/py310/lib/python3.10/site-packages/ray/_private/worker.py:2380: RayTaskError(TypeError)
_______________________________________________________ TestSystem.test_writing_a_technical_blog_post _______________________________________________________
self = <agent_actors.test_system.TestSystem object at 0x7f1656269c00>
def test_writing_a_technical_blog_post(self):
writer = self.create_child(
"Writer",
traits=[
"brilliant technical writer",
"programmer in a past life",
],
)
researcher = self.create_child(
"Researcher",
traits=[
"expert researcher",
"expert programmer",
],
)
cto = self.create_parent(
"CTO",
traits=["kind human", "expert programmer", "visionary technologist"],
children={2: researcher, 42: writer},
)
with open("./README.md", "r") as f:
"""
You can load your actors with memories, here, since all actors share
the same vectorstore, this will be available to all actors.
"""
cto.add_memory(f.read())
> cto.run(
task=f"Write a blog post about Agent Actors, a new python repository that helps you build trees of AI agents that work together to solve more complex problems. Use your memory rather than searches to learn more about Agent Actors. If you're going to search, then search for the Actor Model of Concurrency, Elixir / OTP and Plan-Do-Check-Act cycles"
)
agent_actors/test_system.py:191:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
agent_actors/parent.py:104: in run
results = ray.get(tasks_completed)
../../../anaconda3/envs/py310/lib/python3.10/site-packages/ray/_private/client_mode_hook.py:105: in wrapper
return func(*args, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
object_refs = [ObjectRef(88543757a8df6d2fcbea5c44d6ff13ad77ef2b840100000001000000), ObjectRef(347cc60e0bb3da74e637a5084ab316bf4ef352...201e637a5084ab316bf4ef352260100000001000000), ObjectRef(c1464dc5b2308f10cbea5c44d6ff13ad77ef2b840100000001000000), ...]
@PublicAPI
@client_mode_hook(auto_init=True)
def get(
object_refs: Union[ray.ObjectRef, Sequence[ray.ObjectRef]],
*,
timeout: Optional[float] = None,
) -> Union[Any, List[Any]]:
"""Get a remote object or a list of remote objects from the object store.
This method blocks until the object corresponding to the object ref is
available in the local object store. If this object is not in the local
object store, it will be shipped from an object store that has it (once the
object has been created). If object_refs is a list, then the objects
corresponding to each object in the list will be returned.
Ordering for an input list of object refs is preserved for each object
returned. That is, if an object ref to A precedes an object ref to B in the
input list, then A will precede B in the returned list.
This method will issue a warning if it's running inside async context,
you can use ``await object_ref`` instead of ``ray.get(object_ref)``. For
a list of object refs, you can use ``await asyncio.gather(*object_refs)``.
Related patterns and anti-patterns:
- :doc:`/ray-core/patterns/ray-get-loop`
- :doc:`/ray-core/patterns/unnecessary-ray-get`
- :doc:`/ray-core/patterns/ray-get-submission-order`
- :doc:`/ray-core/patterns/ray-get-too-many-objects`
Args:
object_refs: Object ref of the object to get or a list of object refs
to get.
timeout (Optional[float]): The maximum amount of time in seconds to
wait before returning. Set this to None will block until the
corresponding object becomes available.
WARNING: In future ray releases ``timeout=0`` will return the object
immediately if it's available, else raise GetTimeoutError in accordance with
the above docstring. The current behavior of blocking until objects become
available of ``timeout=0`` is considered to be a bug, see
https://github.com/ray-project/ray/issues/28465.
Returns:
A Python object or a list of Python objects.
Raises:
GetTimeoutError: A GetTimeoutError is raised if a timeout is set and
the get takes longer than timeout to return.
Exception: An exception is raised if the task that created the object
or that created one of the objects raised an exception.
"""
if timeout == 0:
if os.environ.get("RAY_WARN_RAY_GET_TIMEOUT_ZERO", "1") == "1":
import warnings
warnings.warn(
(
"Please use timeout=None if you expect ray.get() to block. "
"Setting timeout=0 in future ray releases will raise "
"GetTimeoutError if the objects references are not available. "
"You could suppress this warning by setting "
"RAY_WARN_RAY_GET_TIMEOUT_ZERO=0."
),
UserWarning,
)
# Record this usage in telemetry
import ray._private.usage.usage_lib as usage_lib
usage_lib.record_extra_usage_tag(usage_lib.TagKey.RAY_GET_TIMEOUT_ZERO, "True")
worker = global_worker
worker.check_connected()
if hasattr(worker, "core_worker") and worker.core_worker.current_actor_is_asyncio():
global blocking_get_inside_async_warned
if not blocking_get_inside_async_warned:
logger.warning(
"Using blocking ray.get inside async actor. "
"This blocks the event loop. Please use `await` "
"on object ref with asyncio.gather if you want to "
"yield execution to the event loop instead."
)
blocking_get_inside_async_warned = True
with profiling.profile("ray.get"):
is_individual_id = isinstance(object_refs, ray.ObjectRef)
if is_individual_id:
object_refs = [object_refs]
if not isinstance(object_refs, list):
raise ValueError(
"'object_refs' must either be an ObjectRef or a list of ObjectRefs."
)
# TODO(ujvl): Consider how to allow user to retrieve the ready objects.
values, debugger_breakpoint = worker.get_objects(object_refs, timeout=timeout)
for i, value in enumerate(values):
if isinstance(value, RayError):
if isinstance(value, ray.exceptions.ObjectLostError):
worker.core_worker.dump_object_store_memory_usage()
if isinstance(value, RayTaskError):
> raise value.as_instanceof_cause()
E ray.exceptions.RayTaskError(InvalidRequestError): ray::AgentActor.run() (pid=32550, ip=192.168.1.71, repr=<agent_actors.actors.AgentActor object at 0x7f0f8a934f10>)
E File "/home/luca/py_conda/agents/agent-actors/agent_actors/actors.py", line 12, in run
E return self.agent.run(*args, **kwargs)
E File "/home/luca/py_conda/agents/agent-actors/agent_actors/child.py", line 42, in run
E result = self.do(
E File "/home/luca/anaconda3/envs/py310/lib/python3.10/site-packages/langchain/chains/base.py", line 116, in __call__
E raise e
E File "/home/luca/anaconda3/envs/py310/lib/python3.10/site-packages/langchain/chains/base.py", line 113, in __call__
E outputs = self._call(inputs)
E File "/home/luca/anaconda3/envs/py310/lib/python3.10/site-packages/langchain/agents/agent.py", line 807, in _call
E output = self.agent.return_stopped_response(
E File "/home/luca/anaconda3/envs/py310/lib/python3.10/site-packages/langchain/agents/agent.py", line 515, in return_stopped_response
E full_output = self.llm_chain.predict(**full_inputs)
E File "/home/luca/anaconda3/envs/py310/lib/python3.10/site-packages/langchain/chains/llm.py", line 151, in predict
E return self(kwargs)[self.output_key]
E File "/home/luca/anaconda3/envs/py310/lib/python3.10/site-packages/langchain/chains/base.py", line 116, in __call__
E raise e
E File "/home/luca/anaconda3/envs/py310/lib/python3.10/site-packages/langchain/chains/base.py", line 113, in __call__
E outputs = self._call(inputs)
E File "/home/luca/anaconda3/envs/py310/lib/python3.10/site-packages/langchain/chains/llm.py", line 57, in _call
E return self.apply([inputs])[0]
E File "/home/luca/anaconda3/envs/py310/lib/python3.10/site-packages/langchain/chains/llm.py", line 118, in apply
E response = self.generate(input_list)
E File "/home/luca/anaconda3/envs/py310/lib/python3.10/site-packages/langchain/chains/llm.py", line 62, in generate
E return self.llm.generate_prompt(prompts, stop)
E File "/home/luca/anaconda3/envs/py310/lib/python3.10/site-packages/langchain/chat_models/base.py", line 82, in generate_prompt
E raise e
E File "/home/luca/anaconda3/envs/py310/lib/python3.10/site-packages/langchain/chat_models/base.py", line 79, in generate_prompt
E output = self.generate(prompt_messages, stop=stop)
E File "/home/luca/anaconda3/envs/py310/lib/python3.10/site-packages/langchain/chat_models/base.py", line 54, in generate
E results = [self._generate(m, stop=stop) for m in messages]
E File "/home/luca/anaconda3/envs/py310/lib/python3.10/site-packages/langchain/chat_models/base.py", line 54, in <listcomp>
E results = [self._generate(m, stop=stop) for m in messages]
E File "/home/luca/anaconda3/envs/py310/lib/python3.10/site-packages/langchain/chat_models/openai.py", line 266, in _generate
E response = self.completion_with_retry(messages=message_dicts, **params)
E File "/home/luca/anaconda3/envs/py310/lib/python3.10/site-packages/langchain/chat_models/openai.py", line 228, in completion_with_retry
E return _completion_with_retry(**kwargs)
E File "/home/luca/anaconda3/envs/py310/lib/python3.10/site-packages/tenacity/__init__.py", line 289, in wrapped_f
E return self(f, *args, **kw)
E File "/home/luca/anaconda3/envs/py310/lib/python3.10/site-packages/tenacity/__init__.py", line 379, in __call__
E do = self.iter(retry_state=retry_state)
E File "/home/luca/anaconda3/envs/py310/lib/python3.10/site-packages/tenacity/__init__.py", line 314, in iter
E return fut.result()
E File "/home/luca/anaconda3/envs/py310/lib/python3.10/concurrent/futures/_base.py", line 451, in result
E return self.__get_result()
E File "/home/luca/anaconda3/envs/py310/lib/python3.10/concurrent/futures/_base.py", line 403, in __get_result
E raise self._exception
E File "/home/luca/anaconda3/envs/py310/lib/python3.10/site-packages/tenacity/__init__.py", line 382, in __call__
E result = fn(*args, **kwargs)
E File "/home/luca/anaconda3/envs/py310/lib/python3.10/site-packages/langchain/chat_models/openai.py", line 226, in _completion_with_retry
E return self.client.create(**kwargs)
E File "/home/luca/anaconda3/envs/py310/lib/python3.10/site-packages/openai/api_resources/chat_completion.py", line 25, in create
E return super().create(*args, **kwargs)
E File "/home/luca/anaconda3/envs/py310/lib/python3.10/site-packages/openai/api_resources/abstract/engine_api_resource.py", line 153, in create
E response, _, api_key = requestor.request(
E File "/home/luca/anaconda3/envs/py310/lib/python3.10/site-packages/openai/api_requestor.py", line 226, in request
E resp, got_stream = self._interpret_response(result, stream)
E File "/home/luca/anaconda3/envs/py310/lib/python3.10/site-packages/openai/api_requestor.py", line 620, in _interpret_response
E self._interpret_response_line(
E File "/home/luca/anaconda3/envs/py310/lib/python3.10/site-packages/openai/api_requestor.py", line 683, in _interpret_response_line
E raise self.handle_error_response(
E openai.error.InvalidRequestError: This model's maximum context length is 4097 tokens. However, you requested 4136 tokens (3112 in the messages, 1024 in the completion). Please reduce the length of the messages or completion.
../../../anaconda3/envs/py310/lib/python3.10/site-packages/ray/_private/worker.py:2380: RayTaskError(InvalidRequestError)
===================================================================== warnings summary ======================================================================
../../../anaconda3/envs/py310/lib/python3.10/site-packages/langchain/output_parsers/pydantic.py:20
/home/luca/anaconda3/envs/py310/lib/python3.10/site-packages/langchain/output_parsers/pydantic.py:20: DeprecationWarning: invalid escape sequence '\{'
"\{.*\}", text.strip(), re.MULTILINE | re.IGNORECASE | re.DOTALL
../../../anaconda3/envs/py310/lib/python3.10/site-packages/langchain/output_parsers/format_instructions.py:3
/home/luca/anaconda3/envs/py310/lib/python3.10/site-packages/langchain/output_parsers/format_instructions.py:3: DeprecationWarning: invalid escape sequence '\`'
STRUCTURED_FORMAT_INSTRUCTIONS = """The output should be a markdown code snippet formatted in the following schema, including the leading and trailing "\`\`\`json" and "\`\`\`":
../../../anaconda3/envs/py310/lib/python3.10/site-packages/faiss/loader.py:28
/home/luca/anaconda3/envs/py310/lib/python3.10/site-packages/faiss/loader.py:28: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
if LooseVersion(numpy.__version__) >= "1.19":
../../../anaconda3/envs/py310/lib/python3.10/site-packages/setuptools/_distutils/version.py:345
/home/luca/anaconda3/envs/py310/lib/python3.10/site-packages/setuptools/_distutils/version.py:345: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
other = LooseVersion(other)
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
================================================================== short test summary info ==================================================================
FAILED agent_actors/test_system.py::TestSystem::test_parent_overhead - TypeError: Chain.__call__() got an unexpected keyword argument 'context'
FAILED agent_actors/test_system.py::TestSystem::test_parallel_map_reduce - ray.exceptions.RayTaskError(TypeError): ray::AgentActor.run() (pid=28647, ip=192.168.1.71, repr=<agent_actors.actors.AgentActor object at 0x7f1a176f4fa0>)
FAILED agent_actors/test_system.py::TestSystem::test_nested_parent_tree - ray.exceptions.RayTaskError(TypeError): ray::AgentActor.run() (pid=30284, ip=192.168.1.71, repr=<agent_actors.actors.AgentActor object at 0x7fa6d57a8eb0>)
FAILED agent_actors/test_system.py::TestSystem::test_writing_a_technical_blog_post - ray.exceptions.RayTaskError(InvalidRequestError): ray::AgentActor.run() (pid=32550, ip=192.168.1.71, repr=<agent_actors.actors.AgentActor object at 0x7f0f8a934f10>)
ERROR agent_actors/test_system.py::TestSystem::test_child_ability - pydantic.error_wrappers.ValidationError: 1 validation error for WolframAlphaAPIWrapper
ERROR agent_actors/test_system.py::TestSystem::test_parent_overhead - pydantic.error_wrappers.ValidationError: 1 validation error for WolframAlphaAPIWrapper
ERROR agent_actors/test_system.py::TestSystem::test_parallel_map_reduce - pydantic.error_wrappers.ValidationError: 1 validation error for WolframAlphaAPIWrapper
ERROR agent_actors/test_system.py::TestSystem::test_nested_parent_tree - pydantic.error_wrappers.ValidationError: 1 validation error for WolframAlphaAPIWrapper
ERROR agent_actors/test_system.py::TestSystem::test_writing_a_technical_blog_post - pydantic.error_wrappers.ValidationError: 1 validation error for WolframAlphaAPIWrapper
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.