Comments (8)
It seemed to have been a indentation error. I formatted it in vscode and then the error gone away. I however seemed to have been trying to do a search instead of choosing one of the playlists IDs. It seemed to be working after I removed the "search_music" spec. I read from the logs that it tried to call that one instead. It started the playlist at least. Is there a way to specify so that it doesn't mix them up?
New spec:
- spec:
name: play_music_playlist
description: Use this function to play music from a playlist.
parameters:
type: object
properties:
playlist_id:
type: string
description: The ID of the playlist
required:
- playlist_id
function:
type: composite
sequence:
- type: script
sequence:
- service: media_player.play_media
data:
entity_id: media_player.youtube_music
media_content_id: "{{ playlist_id }}"
media_content_type: playlist
announce: true
from extended_openai_conversation.
Sorry, I had a problem talking to OpenAI: [] is too short - 'functions'
I will change an error message and not even call API in next release if failed to load yaml functions.
Is there a way to specify so that it doesn't mix them up?
Please correct me if I'm wrong.
What you are trying to do is that you want gpt to look for playlists from prompt first, and search for playlists if it's not present in prompt.
As far as I know, you can try to tell gpt to do so by modifying prompt or description or name of functions.
Achieving this with general prompt is ideal, but specifically tell gpt about your case is totally fine like below (I haven't tested).
Do not search music for playlists if provided
from extended_openai_conversation.
As far as I know, you can try to tell gpt to do so by modifying prompt or description or name of functions.
Achieving this with general prompt is ideal, but specifically tell gpt about your case is totally fine like below (I haven't tested).
Do not search music for playlists if provided
That's smart, I'll test that!
I'm also thinking if it's possible to make "if"-type statements for a spec. If ytube_music_player already has a chosen media player or is playing media already to have it either skip choosing a media player or switch media player. Perhaps that can be put in the specs description too.
from extended_openai_conversation.
Oh, I haven't thought about it.
Could you give me an example of spec that you want to achieve?
Can't you achieve it by putting either choose or skip media player in prompt?
from extended_openai_conversation.
I'm still experimenting around at the moment with trying out the prompt. My ultimate goal is for the AI to be fully able to control ytube_music_player so gonna have to write a spec for every function I think.
Progress is a bit slow right now due to my setup and school. So far I got this:
- spec:
name: music_playlist
description: Use this function to play music from a playlist. If asked to play a playlist do not use the search_music function
parameters:
type: object
properties:
playlist_id:
type: string
description: The ID of the playlist
required:
- playlist_id
function:
type: composite
sequence:
- type: script
sequence:
- service: media_player.play_media
data:
entity_id: media_player.youtube_music
media_content_id: "{{ playlist_id }}"
media_content_type: playlist
announce: true
- spec:
name: music_start_radio
description: Start a radio of the current song that plays similar music.
parameters:
type: object
properties:
dummy:
type: string
description: Nothing
function:
type: composite
sequence:
- type: script
sequence:
- service: ytube_music_player.start_radio
data:
entity_id: media_player.youtube_music
interrupt: false
- spec:
name: search_music
description: Use this function to search music. Do not search if a playlist name is provided.
parameters:
type: object
properties:
query:
type: string
description: The query
required:
- query
function:
type: composite
sequence:
- type: script
sequence:
- service: ytube_music_player.search
data:
entity_id: media_player.youtube_music
query: "{{ query }}"
- type: template
value_template: >-
media_content_type,media_content_id,title
{% for media in state_attr('sensor.ytube_music_player_extra', 'search') -%}
{{media.type}},{{media.id}},{{media.title}}
{% endfor%}
- spec:
name: music_choose_player
description: This function will choose the player to play back media to. Can also be used to switch current playback device.
parameters:
type: object
properties:
playback_device:
type: string
description: The speaker to play music on. Use entity ID of a speaker.
required:
- playback_device:
function:
type: composite
sequence:
- type: script
sequence:
- service: media_player.select_source
data:
source: "{{playback_device}}"
entity_id: media_player.youtube_music
I'm wondering if there's other properties for the different settings? Does the parameters have different types other than object or a different property type other than string for example?
Edit: Also here's the current error I'm trying to fix, not sure if my way to do it is possible;
Sorry, I had a problem talking to OpenAI: Invalid schema for function 'music_choose_player': {'playback_device': None} is not of type 'string'
from extended_openai_conversation.
Perhaps like the search_music spec I could do something in the template section? Since the ytube_music_player device shows which device is currently playing, it could perhaps base of off that?
So if the device is selected on the ytube_media_player property remote_player_id:
don't initiate choose_player, else initiate choose.player.
from extended_openai_conversation.
Edit: Also here's the current error I'm trying to fix, not sure if my way to do it is possible;
Sorry, I had a problem talking to OpenAI: Invalid schema for function 'music_choose_player': {'playback_device': None} is not of type 'string'
In required
field, I think it should be changed from - playback_device:
to - playback_device
like below.
- spec:
name: music_choose_player
description: This function will choose the player to play back media to. Can also be used to switch current playback device.
parameters:
type: object
properties:
playback_device:
type: string
description: The speaker to play music on. Use entity ID of a speaker.
required:
- playback_device
function:
type: composite
sequence:
- type: script
sequence:
- service: media_player.select_source
data:
source: "{{playback_device}}"
entity_id: media_player.youtube_music
Perhaps like the search_music spec I could do something in the template section? Since the ytube_music_player device shows which device is currently playing, it could perhaps base of off that?
It seems that you want a feature like if-then in script function.
The "script" type function is designed to be same as script integration in Home Assistant, but it currently has a bug when using if-then statement. I'm working on it, and it will probably be fixed in the next release.
However, you can achieve if-then
clause by creating a separate script.
Currently not working (will be fixed in the next release)
Functions
- spec:
...
function:
type: script
sequence:
- if:
- condition: state
entity_id: ...
state: "..."
then:
- service: media_player.select_source
data: ...
Workaround
Functions
- spec:
...
function:
type: script
sequence:
- service: script.youtube_music_select_source
script.youtube_music_select_source
alias: youtube_music_select_source
sequence:
- if:
- condition: state
entity_id: ...
state: "..."
then:
- service: media_player.select_source
data: ...
mode: single
from extended_openai_conversation.
The script function now supports if-then statement in 0.0.9
.
from extended_openai_conversation.
Related Issues (20)
- Calendar: Ask about specific events HOT 2
- Google Search Error HOT 6
- Custom Functions & Retrival of Documents, Notes... with PrivateGPT or Anything LLM HOT 5
- llama_cpp.server -- Input should be [...] and 500 Internal Server Error HOT 2
- Example Function "is_valid_entity" verifies given entity_ids if they are exposed, visible, etc.
- Expose service to call AI assistant to generate message in automatisation (Feature) HOT 1
- [Feature Request] Make helper function is_exposed() more available
- Something went wrong. Service call requested response data but did not match any entities. HOT 7
- What "expected_output" for open interpreter?
- Converting Llama3/Ollama to CrewAI creates an unusable (and angry) LLM
- No context history HOT 5
- Internet Access? HOT 8
- panic: Unrecognized schema: map[] HOT 6
- "Unexpected exception" error during integration suggests a problem with the OpenAI server URL
- Something went wrong service sensor.read not found HOT 2
- [Request] Schedule things ("turn off fan in 20 minutes") HOT 1
- Blocking call to open inside event loop warnings on 2024.6 dev HOT 2
- get_attributes function only pulls current day from weather.forecast_home HOT 1
- How to upgrade to gpt-4o HOT 5
- Migrate to native LLM API support in Home Assistant
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from extended_openai_conversation.