This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
struct PulsingHearts: View { | |
let hearts: [(image: String, animation: Animation)] = [ | |
("heartSpring", .bouncy(duration: 1, extraBounce: 0.6)), | |
("heartSky", .bouncy(duration: 1, extraBounce: 0.4).delay(0.1)), | |
("heartStrawberry", .bouncy(duration: 1, extraBounce: 0.2).delay(0.2)) | |
] | |
var body: some View { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from swarm import Swarm, Agent | |
client = Swarm() | |
mini_model = "gpt-4o-mini" | |
# Coordinator function | |
def transfer_to_agent_b(): | |
return agent_b |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from phi.agent import Agent | |
from phi.model.openai import OpenAIChat | |
from phi.tools.duckduckgo import DuckDuckGo | |
from phi.tools.yfinance import YFinanceTools | |
from phi.model.xai import xAI | |
from phi.playground import Playground, serve_playground_app | |
from fastapi import FastAPI | |
# Create web search agent |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import openai | |
from phi.agent import Agent | |
from phi.model.openai import OpenAIChat | |
from phi.tools.yfinance import YFinanceTools | |
from dotenv import load_dotenv | |
import os | |
# Load environment variables from .env file | |
load_dotenv() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
struct MoveFromAToB: View { | |
// Define the two points for horizontal animation | |
let pointA = CGPoint(x: 60, y: 330) // Changed x to 50 | |
let pointB = CGPoint(x: 700, y: 330) // Changed x to 350 | |
var body: some View { | |
PhaseAnimator([pointA, pointB]) { point in | |
Circle() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
struct ChangeSize: View { | |
var body: some View { | |
// Use PhaseAnimator to continuously animate between two scale values | |
PhaseAnimator([1.0, 0.5]) { scale in | |
Circle() | |
.fill(Color.blue) | |
.frame(width: 80, height: 80) | |
.scaleEffect(scale) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
struct DragFromAToB: View { | |
// State to track the circle's position | |
@State private var position = CGPoint(x: UIScreen.main.bounds.width / 2, y: UIScreen.main.bounds.height / 2) | |
// State to track the drag gesture's translation | |
@State private var dragOffset = CGSize.zero | |
var body: some View { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
struct IncreaseDecrease: View { | |
@State private var rating: Int = 0 | |
var body: some View { | |
HStack(spacing: 20) { | |
// Decrease button | |
Button("Decrease", systemImage: "minus.circle") { | |
withAnimation { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from phi.agent import Agent | |
from phi.model.openai import OpenAIChat | |
from phi.embedder.openai import OpenAIEmbedder | |
from phi.knowledge.pdf import PDFUrlKnowledgeBase | |
from phi.vectordb.lancedb import LanceDb, SearchType | |
from phi.playground import Playground, serve_playground_app | |
# Create a knowledge base from a PDF | |
knowledge_base = PDFUrlKnowledgeBase( | |
urls=["https://phi-public.s3.amazonaws.com/recipes/ThaiRecipes.pdf"], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from phi.agent import Agent | |
from phi.model.openai import OpenAIChat | |
task = "Create a SwiftUI view that allows users to switch between the tab bar and sidebar views using TabView and .tabView(.sidebarAdaptable) modifier. Put the content in TabSidebar.swift" | |
reasoning_agent = Agent( | |
model=OpenAIChat(id="gpt-4o-mini"), | |
reasoning=True, | |
markdown=True, | |
structured_outputs=True, |
NewerOlder