Skip to content

Commit

Permalink
v2.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ashpreetbedi committed Jan 15, 2024
1 parent a4dd144 commit b793ef7
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 10 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ duckdb_assistant = DuckDbAssistant(
}
]
}),
show_tool_calls=True,
)
duckdb_assistant.print_response("What is the average rating of movies? Show me the SQL.")
Expand Down Expand Up @@ -231,7 +232,7 @@ INFO Running: SELECT AVG(Rating) AS average_rating
<summary><h3>Structured output from a Movie Assistant</h3></summary>
One of our favorite features is generating structured data (i.e. a pydantic model) from sparse information.
Meaning we can use LLMs to return pydantic models and generate content which previously could not be possible.
Meaning we can use Assistants to return pydantic models and generate content which previously could not be possible.
In this example, our movie assistant generates an object of the `MovieScript` class.
- Create a file `movie_assistant.py`
Expand Down
2 changes: 1 addition & 1 deletion phi/assistant/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from phi.assistant.assistant import Assistant, AssistantRow
from phi.assistant.assistant import Assistant, AssistantRow, AssistantMemory, AssistantStorage, KnowledgeBase
2 changes: 1 addition & 1 deletion phi/llm/openai/chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

class OpenAIChat(LLM):
name: str = "OpenAIChat"
model: str = "gpt-3.5-turbo-1106"
model: str = "gpt-4-1106-preview"
seed: Optional[int] = None
max_tokens: Optional[int] = None
temperature: Optional[float] = None
Expand Down
12 changes: 7 additions & 5 deletions phi/task/llm/llm_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,11 +240,13 @@ def get_system_prompt(self) -> Optional[str]:
_instructions.append("Search the knowledge base for information")
if self.knowledge_base is not None:
_instructions.append("Always prefer information from the knowledge base over your own knowledge.")
_instructions.extend([
"Do not use phrases like 'based on the information provided'.",
"Never mention about your knowledge base or the tools you have access to.",
"If you don't know the answer, say 'I don't know'.",
])
_instructions.extend(
[
"Do not use phrases like 'based on the information provided'.",
"Never mention about your knowledge base or the tools you have access to.",
"If you don't know the answer, say 'I don't know'.",
]
)

# Add instructions for using tools
if self.tool_calls or self.tools is not None:
Expand Down
2 changes: 2 additions & 0 deletions phi/tools/python.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ def save_to_file_and_run(
If successful, returns the value of `variable_to_return` if provided otherwise returns a success message.
If failed, returns an error message.
Make sure the file_name ends with `.py`
:param file_name: The name of the file the code will be saved to.
:param code: The code to save and run.
:param variable_to_return: The variable to return.
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[project]
name = "phidata"
version = "2.2.0.dev5"
description = "AI Toolkit for Engineers"
version = "2.2.0"
description = "Build AI Assistants using language models"
requires-python = ">=3.7"
readme = "README.md"
authors = [
Expand Down

0 comments on commit b793ef7

Please sign in to comment.