Post

Replies

Boosts

Views

Activity

Reply to Avoid hallucinations and information from trainning data
Thanks a lot for your super-fast advice! My results have increased quality. I only need a bit more of information about when is a best practique incorporate a description for a Guided attribute. @Generable struct SearchSuggestions { @Guide(description: "A list of suggested search terms", .count(4)) var searchTerms: [String] } Listening the WWDC25 session "Deep dive into Foundation Generation Models" from min 9:00 to 9:15: Multiline Foundation Models will even automatically include details about your Generable type in the prompt, in a specific format that the model has been trained on. You don’t have to tell it about what fields your Generable type has BlockQuote I interpret that with an auto-descriptive name to the attribute like "SearchSuggestions" write a description is overwork because the model already may infer what must be the content. Am I right? If my state is true, go deeper and learn what must be set in the description. Some examples would be the best to set clearly best practiques 😀
Oct ’25
Reply to FoundationModel, context length, and testing
I have realized the input tokens are variable, most variations are when the sampling strategy is default, but around 100, I think it is not a quantity that makes the crash by exceeded context capacity, but it is curious. Other think that I realized is when the request has defined values like the threshold, temperature and so on the variability decreases. And totally disappears when we are on "greedy" or using Seed. I upload a video to YouTube with several runs of the same request that is measured with instruments: 🎦 https://youtu.be/eSMA-e1j4ps Other think that I don't understand is why input tokens are sent when response is completed my feel is like some checks are done before the Foundation Models API returns a response. Could you confirm? Thank you in advance. ‼️ I approach this post to point an issue: when the model is in "stream" response mode ➡️ it seems the output tokens are no measured, it seems the count stops after receives the first chunk of output tokens, always is 2. Check at moment 30 seconds of the video.
Nov ’25
Reply to FoundationModel, context length, and testing
Hi I share the code of function that launches the stream query: func lanzarPeticion() async{ defer{👎🔘lanzarConsulta.toggle()} do { let sessionStream = LanguageModelSession(model: modelStream, instructions: instructions) let genOptions = generarSamplingMode(temperatura: temperatura, maxResponseTokens: maxResponseTokens, probabilityThreshold: probabilityThreshold, topK: topK, seed: semilla) let responseStream = sessionStream.streamResponse( to: prompt, options: genOptions) for try await partial in responseStream { withAnimation{ self.respuesta = partial.content t.createPartialTime() } } withAnimation{ t.stop() } } catch { // all the logic for errors } } Clarifications about the code: First of all, English is dominant on code but sometimes use Spanish, my native language, specially when terms overlap swift or framework ones; I have my own emoji rules to avoid characters an improve readability (at this moment I'm indie developer so I set the rules) The defer block is to "free" the button that launches the request to avoid double clicks that will generate 2 successive requests. The t instance is a timer. The function "generarSamplingMode" collects all the values of View and set the sampling mode. I'm using Xcode Version 26.0 (17A324) instructions and prompt instances are State attributes that takes the values in Screen, it's straight forward. Other issue is the output tokens on stream mode. Please, re-watch again between 0:29 and 0:56 I executed a batch of three runs on streaming mode and the output is always 2 tokens. With other apps the same result. My intuition is maybe it stops counting when its receives the first output or the counter isn't able to update with a continuous flow of updates.
Nov ’25