Skip to content

Commit

Permalink
chore: Updated the structure
Browse files Browse the repository at this point in the history
  • Loading branch information
Shubhamsaboo committed Nov 5, 2024
1 parent 1d0b440 commit 1a8f4fd
Show file tree
Hide file tree
Showing 113 changed files with 62 additions and 0 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file not shown.
19 changes: 19 additions & 0 deletions ai_agent_tutorials/ai_reasoning_agent/reasoning_agent.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
from phi.agent import Agent
from phi.model.openai import OpenAIChat
from phi.cli.console import console

regular_agent = Agent(model=OpenAIChat(id="gpt-4o-mini"), markdown=True)

reasoning_agent = Agent(
model=OpenAIChat(id="gpt-4o"),
reasoning=True,
markdown=True,
structured_outputs=True,
)

task = "How many 'r' are in the word 'supercalifragilisticexpialidocious'?"

console.rule("[bold green]Regular Agent[/bold green]")
regular_agent.print_response(task, stream=True)
console.rule("[bold yellow]Reasoning Agent[/bold yellow]")
reasoning_agent.print_response(task, stream=True, show_full_reasoning=True)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
36 changes: 36 additions & 0 deletions ai_agent_tutorials/legal_ai_agent/legal_agent.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
from phi.agent import Agent
from phi.model.openai import OpenAIChat
from phi.knowledge.pdf import PDFKnowledgeBase, PDFReader
from phi.vectordb.lancedb import LanceDb, SearchType
from phi.playground import Playground, serve_playground_app
from phi.tools.duckduckgo import DuckDuckGo

# Set up configurations
DB_URI = "tmp/legal_docs_db"

# Create a knowledge base for legal documents
knowledge_base = PDFKnowledgeBase(
path="tmp/legal_docs",
vector_db=LanceDb(
table_name="legal_documents",
uri=DB_URI,
search_type=SearchType.vector
),
reader=PDFReader(chunk=True),
num_documents=5
)

# Create the agent
agent = Agent(
model=OpenAIChat(id="gpt-4"),
agent_id="legal-analysis-agent",
knowledge=knowledge_base,
tools=[DuckDuckGo()],
show_tool_calls=True,
markdown=True,
)

app = Playground(agents=[agent]).get_app()

if __name__ == "__main__":
serve_playground_app("legal_agent:app", reload=True)
7 changes: 7 additions & 0 deletions ai_agent_tutorials/legal_ai_agent/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
streamlit
phidata
openai
lancedb
tantivy
pypdf
duckduckgo-search
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 1a8f4fd

Please sign in to comment.