Post

Replies

Boosts

Views

Activity

Reply to Foundation Models: Please Allow GeneratedContent Init from Array of Key-Value Pairs
To explain a little why this might be useful: – It allows for more use cases of Foundation Models from non-native frameworks like Flutter and React Native. Here is an example of how you can create a bridge from Flutter to Foundation Models, with Dart Tools support. – It also opens up use cases like MCP servers, where tools are dynamically fetched from some config/server. Though not very usable given current model constraints — but still.
Jun ’25
Reply to Foundation Models: Please Allow GeneratedContent Init from Array of Key-Value Pairs
For anyone looking for a temporary solution, you can (but probably shouldn't) do this: struct DynamicKeyValuePairs<K, V> { let _elements: [(K, V)] init(_elements: [(K, V)]) { self._elements = _elements } } let kvp = unsafeBitCast( DynamicKeyValuePairs(_elements: properties), to: KeyValuePairs<String, any ConvertibleToGeneratedContent>.self )
Jun ’25