mirror of
https://github.com/Shubhamsaboo/awesome-llm-apps.git
synced 2026-03-08 23:13:56 -05:00
chore: Updated the structure
This commit is contained in:
BIN
ai_agent_tutorials/ai_reasoning_agent/agents.db
Normal file
BIN
ai_agent_tutorials/ai_reasoning_agent/agents.db
Normal file
Binary file not shown.
19
ai_agent_tutorials/ai_reasoning_agent/reasoning_agent.py
Normal file
19
ai_agent_tutorials/ai_reasoning_agent/reasoning_agent.py
Normal file
@@ -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)
|
||||
36
ai_agent_tutorials/legal_ai_agent/legal_agent.py
Normal file
36
ai_agent_tutorials/legal_ai_agent/legal_agent.py
Normal file
@@ -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
ai_agent_tutorials/legal_ai_agent/requirements.txt
Normal file
7
ai_agent_tutorials/legal_ai_agent/requirements.txt
Normal file
@@ -0,0 +1,7 @@
|
||||
streamlit
|
||||
phidata
|
||||
openai
|
||||
lancedb
|
||||
tantivy
|
||||
pypdf
|
||||
duckduckgo-search
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user