
    h                     x    d Z ddlmZmZ ddlmZ ddlmZ ddlm	Z	m
Z
 ddlmZ  G d de	      Z G d	 d
e      Zy)zTool for the Reddit search API.    )OptionalType)CallbackManagerForToolRun)BaseTool)	BaseModelField)RedditSearchAPIWrapperc                       e Zd ZU dZ ed      Zeed<    ed      Zeed<    ed      Z	eed<    ed	      Z
eed
<    ed      Zeed<   y)RedditSearchSchemazInput for Reddit search.z]should be query string that post title should         contain, or '*' if anything is allowed.)descriptionqueryzashould be sort method, which is one of: "relevance"         , "hot", "top", "new", or "comments".sortzlshould be time period to filter by, which is         one of "all", "day", "hour", "month", "week", or "year"time_filterz9should be name of subreddit, like "all" for         r/all	subredditzMa positive integer indicating the maximum number         of results to returnlimitN)__name__
__module____qualname____doc__r   r   str__annotations__r   r   r   r        j/var/www/html/eduruby.in/venv/lib/python3.12/site-packages/langchain_community/tools/reddit_search/tool.pyr   r      s|    "1E3  /D#  AK  Is  E3 r   r   c                       e Zd ZU dZdZeed<   dZeed<    ee	      Z
e	ed<   eZee   ed<   	 dd
edededededee   defdZy	)RedditSearchRunz+Tool that queries for posts on a subreddit.reddit_searchnamezfA tool that searches for posts on Reddit.Useful when you need to know post information on a subreddit.r   )default_factoryapi_wrapperargs_schemaNr   r   r   r   r   run_managerreturnc           	      T    | j                   j                  ||||t        |            S )zUse the tool.)r   r   r   r   r   )r    runint)selfr   r   r   r   r   r"   s          r   _runzRedditSearchRun._run0   s5     ###e* $ 
 	
r   )N)r   r   r   r   r   r   r   r   r   r	   r    r   r!   r   r   r   r   r(   r   r   r   r   r   %   s    5D#	H   +0@V*WK'W#5Ki5 <@

 
 	

 
 
 78
 

r   r   N)r   typingr   r   langchain_core.callbacksr   langchain_core.toolsr   pydanticr   r   +langchain_community.utilities.reddit_searchr	   r   r   r   r   r   <module>r.      s/    % ! > ) % N 2
h 
r   