-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1d0b440
commit 1a8f4fd
Showing
113 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
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.
Binary file not shown.
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
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.
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
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) |
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
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.
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.