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, |
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 | |
web_search_agent = Agent( | |
name="Web Search Agent", | |
role="Search the web for information", | |
model=OpenAIChat(id="gpt-4o"), |
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 | |
web_agent = Agent( | |
name="Web Agent", | |
model=OpenAIChat(id="gpt-4o-mini"), | |
tools=[DuckDuckGo()], | |
instructions=["Always include sources"], | |
show_tool_calls=True, |
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 | |
web_agent = Agent( | |
name="Web Agent", | |
model=OpenAIChat(id="gpt-4o-mini"), | |
tools=[DuckDuckGo()], | |
instructions=["Always include sources"], | |
show_tool_calls=True, |
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
// | |
// Thinking2.swift | |
// CoreSwiftUI | |
// | |
import SwiftUI | |
struct ThinkingWithAlex: View { | |
@State private var currentPhraseIndex = 0 | |
private let timer = Timer.publish(every: 5, on: .main, in: .common).autoconnect() | |
@State private var thinking = true |
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
# We are now heading towards the future where AI agents will be used to perform many of our daily routine tasks. Anthropic, Microsoft Copilot Studio, IBM Agent. Swarm provides a simple and clean framework for building and running agents with pure Python code. | |
from swarm import Swarm, Agent | |
# Define your preferred model to use. If you dont specify a model, the default will be gpt-4o. So you can override it with a smaller model if you want. | |
mini_model = "gpt-4o-mini" | |
# Start an agent: Initialize a swarm client. This is the entry point for all agents. Behind the scenes, it will manage the API calls to the LLM provider. | |
client = Swarm() | |
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 os | |
import openai | |
import chainlit as cl | |
from llama_index.core import ( | |
Settings, | |
StorageContext, | |
VectorStoreIndex, | |
SimpleDirectoryReader, | |
load_index_from_storage, |
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
// | |
// ThreadsLogoDrawing.swift | |
// CoreSwiftUI | |
import SwiftUI | |
struct ThreadsLogoPath: Shape { | |
func path(in rect: CGRect) -> Path { | |
var path = Path() | |
let width = rect.size.width |
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
// | |
// BasiciOSCalculator.swift | |
import SwiftUI | |
struct BasiciOSCalculator: View { | |
@State private var displayValue: String = "0" | |
@State private var currentOperation: Operation? = nil | |
@State private var previousValue: Double? = nil | |
@State private var shouldResetDisplay: Bool = false |
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
// | |
// MovingDashPhaseButton.swift | |
// CoreSwiftUI | |
// | |
// Created by Amos Gyamfi on 24.8.2024. | |
// | |
import SwiftUI | |
struct MovingDashPhaseButton: View { |
NewerOlder