Skip to content

Not retrieeing my home assistant environment #5

@josep-bravo

Description

@josep-bravo

Hi, i am trying to use sherlock.py for a simple CLI demo, and some problems appear to me:

  1. if executed the sherlock.py inside the folder it is now, so sherlock/sherlock/sherlock.py it appears that
from prompts.prompt import SYSTEM_MSG, HUMAN_MSG, TEMPLATE_TOOL_RESPONSE

crashes not detected by environment. If i move it on the root folder project i can execute

  1. When i execute the python file, if i dont want to suse google or spotify apis, i have to comment everywhere on the code they appear.
  2. When i finally launch, it executes correctly, it prints :
you: turn on lamapda


> Entering new AgentExecutor chain...

Do I need to use a tool right now? Yes
Which tool should I use? Home Assistant Control
Input: ENTITY(light) Turn on lampada


> Finished chain.
Warning: model not found. Using cl100k_base encoding.
Do I need to use a tool right now? Yes
Which tool should I use? Home Assistant Control
Input: ENTITY(light) Turn on lampada
You: 

But the thing is that is not retrieving at all my devices, and actually even though he prints that is going to use home assitant control tool, if i put prints on that tool on the code like:

class HomeAssistantTool:
    description = "The user has a Home Assistant setup. This starts the process for changing things like lights, cameras etc. Use this tool whenever the user needs that sort of thing. Has modes and alerts."
    llm: ChatOpenAI = None

    def __init__(self, llm):
        self.llm = llm

    async def arun(self, query: str) -> str:
        entities = ""
        print('query',query)
        if "ENTITY(" in query:
            entity_keyword = query[query.index("ENTITY(") + 7 : query.index(")")]
            query = query.replace(f"ENTITY({entity_keyword})", "")
            all_entities = ha_entities()
            print('entities', all_entities)
            header = all_entities[0]
            entities = [header] + [
                e for e in all_entities[1:] if entity_keyword.lower() in e.lower()
            ]
            

it never arrives here.

Can someone guideme on why is not detecting my devices? i printed KEY to be sure it is corerct and its fine. Moreover on one iteration it worked correctly and turned on my lamp, but not anymore.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions