-
Novedades del framework Foundation Models
Explora las novedades del framework Foundation Models. Descubre cómo acceder a Computación Privada en la Nube, integrar modelos de terceros y de código abierto, y trabajar con las capacidades de Vision. Descubre las API de administración de contexto, la búsqueda semántica integrada y potentes elementos básicos para crear experiencias agénticas en tus apps.
Capítulos
- 0:00 - Introducción
- 2:34 - Nuevo modelo en el dispositivo
- 3:21 - Vision: comprensión de imágenes
- 4:20 - Private Cloud Compute
- 6:46 - Capa de abstracción del modelo
- 7:32 - Integraciones de modelos de socios
- 9:40 - Herramientas del sistema: Vision y Spotlight
- 10:57 - Dynamic Profiles para apps agénticas
- 13:46 - Composición de modelos y configuraciones
- 15:30 - Framework Evaluations
- 16:02 - La herramienta de línea de comandos fm
- 17:13 - SDK de Python para Foundation Models
- 17:55 - Utilidades de código abierto y del framework
- 19:24 - Próximos pasos
Recursos
-
Buscar este video…
-
-
2:46 - Context size and token counting
// Context size and token counting let model = SystemLanguageModel() print(model.contextSize) // 8192 let count = try await model.tokenCount(for: "What are the Japanese characters for origami?") print(count) -
3:52 - Attachable image types
// Insert c// Attachable image types let response = try await session.respond { "What animal is this?" Attachment(UIImage(...)) }ode snippet. -
8:45 - Inspecting usage
// Inspecting usage let response = try await session.respond( to: "Recommend a craft that doesn't require scissors.", contextOptions: ContextOptions(reasoningLevel: .light) ) print(response.usage.input.totalTokenCount) print(response.usage.input.cachedTokenCount) print(response.usage.output.totalTokenCount) print(response.usage.output.reasoningTokenCount) -
11:55 - Routing between craft analysis and brainstorm
// Routing between craft analysis and brainstorm @Observable final class AppStates { var mode: Mode } let appStates: AppStates var session: LanguageModelSession? func updateSession() { let originalTranscript = session?.transcript.dropFirstInstructions() ?? Transcript() // Create a new session with new instructions and tools switch appStates.mode { case .craftAnalysis: session = LanguageModelSession( tools: [ RecordImageAnalysisTool(), SwitchModeTool(states: appStates) ], instructions: "Analyze the user's craft project...", transcript: originalTranscript ) case .brainstorm: session = LanguageModelSession( tools: [ RecordBrainstormTool(), ], instructions: "Brainstorm some ideas...", transcript: originalTranscript ) } } struct SwitchModeTool: Tool { let description = "Switch to a different mode." let states: AppStates @Generable struct Arguments { let mode: Mode } func call(arguments: Arguments) async throws -> some PromptRepresentable { appStates.mode = arguments.mode return "Successfully switched to \(arguments.mode)." } } // If mode changes, update the session withObservationTracking { appStates.mode } onChange: { updateSession() } -
12:42 - Describing the profile for craft app
// Describing the profile for craft app struct CraftProfile: LanguageModelSession.DynamicProfile { var body: some DynamicProfile { Profile { Instructions { """ You are an expert crafting assistant. \ Record craft project image analyses \ using the recordImageAnalysis tool. """ } RecordImageAnalysisTool() } } } let session = LanguageModelSession( profile: CraftProfile() ) -
14:36 - Describing the profile for craft app
// Describing the profile for craft app struct CraftProfile: LanguageModelSession.DynamicProfile { let states: CraftProjectStates var body: some DynamicProfile { switch states.mode { case .craftAnalysis: Profile { Instructions { /* ... */ } RecordImageAnalysisTool() SwitchModeTool(states: states) } case .brainstorm: Profile { Instructions { /* ... */ } BrainstormRecordTool() } .model(states.privateCloudCompute) .reasoningLevel(.deep) } } } -
18:29 - Foundation Models SDK for Python
# Foundation Models SDK for Python import apple_fm_sdk as fm model = fm.SystemLanguageModel() # Check the model's availability is_available, reason = model.is_available() if is_available: # Create a session session = fm.LanguageModelSession(model=model) # Generate a response response = await session.respond(prompt="Hello!") print(response)
-