diff --git a/.env.example b/.env.example index 79394a6c..e69de29b 100644 --- a/.env.example +++ b/.env.example @@ -1,3 +0,0 @@ -ANTHROPIC_API_KEY=... -TAVILY_API_KEY=... -OPENAI_API_KEY=... diff --git a/my_agent/__pycache__/__init__.cpython-312.pyc b/my_agent/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 00000000..fd6dba4d Binary files /dev/null and b/my_agent/__pycache__/__init__.cpython-312.pyc differ diff --git a/my_agent/agent.py b/my_agent/agent.py index e48c2150..bcabedad 100644 --- a/my_agent/agent.py +++ b/my_agent/agent.py @@ -7,7 +7,7 @@ # Define the config class GraphConfig(TypedDict): - model_name: Literal["anthropic", "openai"] + model_name: Literal[ "openai"] # Define a new graph @@ -50,3 +50,24 @@ class GraphConfig(TypedDict): # This compiles it into a LangChain Runnable, # meaning you can use it as you would any other runnable graph = workflow.compile() + +# def stream_graph_updates(user_input: str): +# for event in graph.stream({"messages": [("user", user_input)]}): +# for value in event.values(): +# print(value) +# print("Assistant:", value["messages"][-1].content) + +# while True: +# try: +# user_input = input("User: ") +# if user_input.lower() in ["quit", "exit", "q"]: +# print("Goodbye!") +# break + +# stream_graph_updates(user_input) +# except: +# # fallback if input() is not available +# user_input = "What do you know about LangGraph?" +# print("User: " + user_input) +# stream_graph_updates(user_input) +# break \ No newline at end of file diff --git a/my_agent/utils/__pycache__/__init__.cpython-312.pyc b/my_agent/utils/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 00000000..72ef4a43 Binary files /dev/null and b/my_agent/utils/__pycache__/__init__.cpython-312.pyc differ diff --git a/my_agent/utils/__pycache__/nodes.cpython-312.pyc b/my_agent/utils/__pycache__/nodes.cpython-312.pyc new file mode 100644 index 00000000..d5194a4f Binary files /dev/null and b/my_agent/utils/__pycache__/nodes.cpython-312.pyc differ diff --git a/my_agent/utils/__pycache__/state.cpython-312.pyc b/my_agent/utils/__pycache__/state.cpython-312.pyc new file mode 100644 index 00000000..f3cc71a3 Binary files /dev/null and b/my_agent/utils/__pycache__/state.cpython-312.pyc differ diff --git a/my_agent/utils/__pycache__/tools.cpython-312.pyc b/my_agent/utils/__pycache__/tools.cpython-312.pyc new file mode 100644 index 00000000..4adfac82 Binary files /dev/null and b/my_agent/utils/__pycache__/tools.cpython-312.pyc differ diff --git a/my_agent/utils/tools.py b/my_agent/utils/tools.py index 58506822..598048dc 100644 --- a/my_agent/utils/tools.py +++ b/my_agent/utils/tools.py @@ -1,3 +1,80 @@ from langchain_community.tools.tavily_search import TavilySearchResults -tools = [TavilySearchResults(max_results=1)] \ No newline at end of file + + +import http.client +import json +from typing import List, Optional, Dict +from pydantic import BaseModel, Field +from langchain.tools import tool + + +class PropertySearchFields(BaseModel): + city: Optional[List[str]] = Field( + None, + description="List of Cities to search properties (e.g., ['Houston', 'Dallas']), CAN NEVER BE A NUMBER", + ) + community: Optional[List[str]] = Field( + None, + description="List of Communities to search properties on. {Key Communities: cinco ranch, copperfield, eaglewood, canyon gate at brazon, clear lake city}", + ) + zip_code: Optional[str] = Field( + None, + description="Numeric Zip code to search properties by, (e.g., 77027, 77024). Zip codes usually start with '77'.", + ) + bedrooms: Optional[Dict[str, int]] = Field( + None, + description="Dictionary with Number of Bedrooms with keys 'min', 'max', or 'equal'", + ) + baths: Optional[Dict[str, int]] = Field( + None, + description="Dictionary with Number of Bathrooms with keys 'min', 'max', or 'equal'", + ) + price: Optional[Dict[str, int]] = Field( + None, + description="Dictionary with Price of property with keys 'min', 'max', or 'equal'", + ) + for_sale: Optional[int] = Field( + 1, description="Indicates if the property is on rent" + ) + +class PropertySearchResultItem(BaseModel): + mlsnum: Optional[str] + address: Optional[str] + price: Optional[float] + beds: int + baths: int + city: str + zipCode: str + sqft: int +#args_schema=PropertySearchFields +class PropertySearchInput(BaseModel): + fields: PropertySearchFields = Field( + ..., description="Input fields to search properties" + ) +@tool(args_schema=PropertySearchInput) +def search_properties(fields: PropertySearchFields) ->Dict: + """Search properties based on input filters.""" + # Implement your API connection and handling here + # Dummy data for the sake of example + print("1") + properties = [ + {"property": + # PropertySearchResultItem( + """ mlsnum="123456", + address="123 Main St", + price=350000.0, + beds=3, + baths=2, + city="Houston", + zipCode="77002", + sqft=1500 """} + # ) + ] + return properties + +# Example use: +# Create an instance of PropertySearchFields with the desired search criteria +# search_criteria = PropertySearchFields(city=["Houston"], max_price=500000) +# properties = search_properties(fields=search_criteria) +tools = [search_properties] \ No newline at end of file