
    Ng                     f    d dl Z d dlmZ d dlmZ d dlmZ d dlmZ d dl	m
Z
  G d de          ZdS )	    N)Optional)CallbackManagerForToolRun)BaseTool)
ConfigDict)GraphQLAPIWrapperc                   v    e Zd ZU dZeed<   dZeed<   dZeed<    e	d          Z
	 dd
edee         defdZd	S )BaseGraphQLToolz%Base tool for querying a GraphQL API.graphql_wrapperquery_graphqlnamea      Input to this tool is a detailed and correct GraphQL query, output is a result from the API.
    If the query is not correct, an error message will be returned.
    If an error is returned with 'Bad request' in it, rewrite the query and try again.
    If an error is returned with 'Unauthorized' in it, do not try again, but tell the user to change their authentication.

    Example Input: query {{ allUsers {{ id, name, email }} }}    descriptionT)arbitrary_types_allowedN
tool_inputrun_managerreturnc                 b    | j                             |          }t          j        |d          S )N   )indent)r
   runjsondumps)selfr   r   results       b/var/www/html/ai-engine/env/lib/python3.11/site-packages/langchain_community/tools/graphql/tool.py_runzBaseGraphQLTool._run   s/    
 %))*55z&++++    )N)__name__
__module____qualname____doc__r   __annotations__r   strr   r   model_configr   r   r    r   r   r	   r	      s         //&&&&D#K    : $  L <@, ,, 78, 
	, , , , , ,r   r	   )r   typingr   langchain_core.callbacksr   langchain_core.toolsr   pydanticr   %langchain_community.utilities.graphqlr   r	   r$   r   r   <module>r*      s           > > > > > > ) ) ) ) ) )       C C C C C C, , , , ,h , , , , ,r   