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

[#140] Make local image accessible in query_image service #154

Merged
merged 2 commits into from
Feb 21, 2024

Conversation

jekalmin
Copy link
Owner

Issue

Objective

  • Make local image to be accessible in extended_openai_conversation.query_image.

Example

@jekalmin jekalmin added this to the 1.0.4 milestone Feb 21, 2024
@jekalmin jekalmin self-assigned this Feb 21, 2024
@jekalmin jekalmin changed the base branch from main to v1.0.4 February 21, 2024 16:10
@jekalmin jekalmin merged commit 520cf4b into v1.0.4 Feb 21, 2024
4 checks passed
@jekalmin jekalmin changed the title [#140] Make local image to be attached in query_image service [#140] Make local image accessible in query_image service Feb 21, 2024
@LowKey88
Copy link

LowKey88 commented Feb 21, 2024

Tested, but the messages seem called the id,etc, intead of content.

Here my yaml :

  • service: extended_openai_conversation.query_image
    data:
    images:
    url: /xx/xx/xxx/xxx.jpg
    max_tokens: 300
    config_entry: xx
    prompt: >-
    Very briefly describe what you see in this image from camera. Your
    message needs to be short to fit in a phone notification. Don't describe
    stationary objects.
    model: gpt-4-vision-preview
    response_variable: ai_description
  • service: telegram_bot.send_message
    data_template:
    message: "AI description: {{ ai_description }}"
    enabled: true
  • service: tts.cloud_say
    target:
    entity_id: media_player.studio_google_nest
    data:
    message: "{{ ai_description }}"
    cache: true
    enabled: true

Output on Telegram

AI description: {'id': 'chatcmpl-xxx', 'choices': {'finish_reason': 'stop', 'index': 0, 'message': {'content': 'No people or moving objects in view; only room interior visible.', 'role': 'assistant', 'function_call': None, 'tool_calls': None}}, 'created': 1708535671, 'model': 'gpt-4-1106-vision-preview', 'object': 'chat.completion', 'systemfingerprint': None, 'usage': {'completiontokens': 13, 'prompttokens': 463, 'totaltokens': 476}}

@jekalmin
Copy link
Owner Author

messages seem called the id,etc, intead of content

Could you elaborate more?
You need to use {{ ai_description.choices[0].message.content }} to get response message.

@LowKey88
Copy link

messages seem called the id,etc, intead of content

Could you elaborate more? You need to use {{ ai_description.choices[0].message.content }} to get response message.

Awesome, thanks for the code. I've made the updates and used it as suggested. It now outputs only the response message.

Excellent! :)

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.

None yet

2 participants