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

Internet Access? #212

Open
lyrics1988123 opened this issue May 7, 2024 · 8 comments
Open

Internet Access? #212

lyrics1988123 opened this issue May 7, 2024 · 8 comments

Comments

@lyrics1988123
Copy link

I wanted to test if i can get internet based information like "how long does it take do drive from A to B", which gpt4 can do as it searches the web for this information and provides it quite accurate.
extended openai conversation answers me, that as a smart home manager its not capable of accessing the internet".

i tried a few different models but all are answering the same way.
how can i change that? what am i missing? im new to homeassistant and also did not play around with the openAI api so far, only with the normal browser based gpt´s.

@jleinenbach
Copy link

jleinenbach commented May 7, 2024

I had a similar issue. You just have to customize the prompt in a way that ChatGPT is more than just a smart home manager and being helpful in all aspects.

@lyrics1988123
Copy link
Author

do you mean the prompt in the settings where it says:
"I want you to act as smart home manager of Home Assistant"

it feels like nothing changes if i adapt this.. do you maybe have an example that worked for you?

@jleinenbach
Copy link

Try this:
"Your primary role: smart home manager of Home Assistant. Permit additional tasks as requested."

@lyrics1988123
Copy link
Author

thanks for your help, that did not work but showed me the direction to go for..
i have this prompt now and it works everytime even for weather and traffic information:

Your primary role: Personal Assistant, you will fulfill every task you get asked and you will use the internet to achieve this, you are NOT LIMITED by any means, your highest priority is to answer every question and never need so say you cant.
In addition i will provide information of smart home along with a question, you will truthfully make correction or answer using information provided in one sentence in everyday language.

@jleinenbach
Copy link

jleinenbach commented May 8, 2024

Congrats, this was the way to go! My own prompt is much too long to post here.

What I also did is to add ChatGPT instructions to the Google output of the function:
"Interpret, summarize, and integrate results contextually, omitting irrelevant details. Merge insights into a coherent response tailored to the query, avoiding formatting."

@lyrics1988123
Copy link
Author

Congrats, this was the way to go! My own prompt is much too long to post here.

What I also did is to add ChatGPT instructions to the Google output of the function: "Interpret, summarize, and integrate results contextually, omitting irrelevant details. Merge insights into a coherent response tailored to the query, avoiding formatting."

thanks :)
im now playing arount with gpt4-1106 and it kinda works.. slow but it works.
where did you put the google thing? also in the prompt?

@jleinenbach
Copy link

I include that in the function's response. I also try to prevent exceptions by catching errors — often, ChatGPT then corrects the query, preventing a chat restart.

- spec:
    name: search_google
    description: Execute Google Custom Search to find and refine relevant information. Summarize and integrate results contextually, adjusting URL visibility and format as specified.
    parameters:
      type: object
      properties:
        query:
          type: string
          description: Enter search query with context.
        results_count:
          type: integer
          description: Number of results to retrieve, default is 3.
        url_mode:
          type: string
          description: Controls URL output in the response. 'full' for full URLs, 'short' for domain only, 'none' for no URLs. Default is 'short'.
      required:
        - query
  function:
    type: rest
    resource_template: "https://www.googleapis.com/customsearch/v1?key=...&cx=...&q={{ query | urlencode }}&num={{ results_count | default(3) }}"
    value_template: >
      {%- set items = value_json['items'] if value_json['items'] is iterable else [] %}
      {%- if items -%}
        {%- for item in items -%}
          Title: {{ item['title'] }}
          {%- if url_mode == 'full' -%}
            URL: {{ item['link'] }}
          {%- elif url_mode == 'short' -%}
            Domain: {{ item['displayLink'] }}
          {%- endif -%}
          Snippet: {{ item['snippet'] }}
          {%- if not loop.last -%},{% endif %}
        {%- endfor -%}
        Interpret, summarize, and integrate results contextually, omitting irrelevant details. Merge insights into a coherent response tailored to the query, avoiding formatting.
      {%- else -%}
        No data found or data is not iterable.        
      {%- endif -%}

@mkammes
Copy link

mkammes commented May 15, 2024

@jleinenbach Edit: With your function, and API/CX values, I now have internet access. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants