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

[#43] add "query_image" service #60

Merged
merged 2 commits into from
Jan 17, 2024
Merged

[#43] add "query_image" service #60

merged 2 commits into from
Jan 17, 2024

Conversation

jekalmin
Copy link
Owner

@jekalmin jekalmin commented Dec 24, 2023

Objective

  • Add "query_image" service to upload an image to gpt
  • Although it's not ideal, let gpt know via function response content returned from service call (extended_openai_conversation.query_image).

Service

Example

  • I tested with following image searched from website

Function

- spec:
    name: get_refrigerator_items
    description: Get description of items in refrigerator
    parameters:
      type: object
      properties:
        url:
          type: string
          description: image url of refrigerator
          enum:
            - https://i.pinimg.com/originals/8b/cc/f1/8bccf14daf77ce887fc162934335cb21.jpg # needs to change
      required:
      - url
  function:
    type: composite
    sequence:
      - type: script
        sequence:
          - service: extended_openai_conversation.query_image
            data:
              prompt: What alcohol and brands do you see in this picture?
              images:
                - url: "{{url}}"
              max_tokens: 300
              config_entry: YOUR_CONFIG_ENTRY_KEY # needs to change
            response_variable: _function_result
        response_variable: image_result
      - type: template
        value_template: "{{image_result.choices[0].message.content}}"

@jekalmin jekalmin self-assigned this Dec 24, 2023
@jekalmin jekalmin changed the base branch from v0.0.10 to v0.0.11 January 1, 2024 10:54
@TBTHEDBA
Copy link

How did I add this service?

@jekalmin
Copy link
Owner Author

How did I add this service?

I haven't released it yet. Let me release this in beta.

@jekalmin jekalmin changed the base branch from v0.0.11 to v1.0.1 January 13, 2024 15:27
@jekalmin jekalmin marked this pull request as ready for review January 17, 2024 14:15
@jekalmin jekalmin merged commit 0f3d847 into v1.0.1 Jan 17, 2024
4 checks passed
@jekalmin jekalmin added this to the 1.0.1 milestone Jan 17, 2024
@jekalmin
Copy link
Owner Author

@TBTHEDBA
I just released this in 1.0.1-beta2.
Please try this and give a feedback :D

@TBTHEDBA
Copy link

TBTHEDBA commented Jan 17, 2024 via email

@jekalmin
Copy link
Owner Author

jekalmin commented Jan 17, 2024

Try to call service from developers tools.
You can get entry key from there.

ui mode yaml mode
Screenshot_20240118_012737_Home Assistant Screenshot_20240118_012903_Home Assistant

@TBTHEDBA
Copy link

TBTHEDBA commented Jan 17, 2024 via email

@jekalmin jekalmin deleted the add-query-image branch February 4, 2024 12:03
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

Successfully merging this pull request may close these issues.

2 participants