
    :ju                         d Z ddlZddlmZmZmZ ddlmZ ddl	m
Z
m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 ede       y)z"
GooeyAI provider implementation.
    N)DictListOptional)ErrorReason)CheckResult	Condition)get_user_agent)trim   )chat   )AIBaseProvider)register_providerc                        e Zd ZdZdee   f fdZddedee	   dee	   fdZ
ddeded	ed
edef
dZddeded	edee   fdZ xZS )GooeyAIProviderz GooeyAI provider implementation.
conditionsc           	      ~    | j                  |dddddd      }t        |   |d   |d   |d	   |d
   |d   |fi | y )Ngooeyaizhttps://api.gooey.aiz/v2/google-gpt gpt_4_o_mini)namebase_urlcompletion_path
model_pathdefault_modelr   r   r   r   r   )extractsuper__init__)selfr   kwargsconfig	__class__s       >/root/.openclaw/workspace/harvester/search/provider/gooeyai.pyr   zGooeyAIProvider.__init__   sl    !2#3 !/	
 	6N:$%< ?#	
 	
    token
additionalreturnc                 f    t        |      }|syddd| t               d}| j                  ||      S )z%Get headers for GooeyAI API requests.Nzapplication/jsonzBearer )acceptzcontent-typeauthorizationz
user-agent)r
   r	   _merge_headers)r   r%   r&   headerss       r#   _get_headerszGooeyAIProvider._get_headers.   sE    U ).&ug.(*	
 ""7J77r$   addressendpointmodelc                    | j                  |      }|s#t        j                  t        j                        S t        |      xs | j                  }t        j                  j                  | j                  | j                        }dd|ddddddd	d

}t        |||| j                  d      | j                  d            \  }}	| j                  ||	      S )zCheck GooeyAI token validity.)r%   a  I'm looking for 4 stats that have a negative spin and create FOMO/urgency. and 4 stats that have a positive spin.

I only want stats that focus on how Al can help people, teams and companies be better.

Search the web for reports created this year. Only cite actual stats from those reports. BE CAREFUL. Give a link to each source after each stat. Preferably use reports from companies like Microsoft, Linkedin, Gartner, PWC, Deloitte, Accenture, BCG, McKinsey.r      openai_3_largeTi  r   json_object)
search_querysite_filterselected_modelmax_search_urlsmax_referencesembedding_modelavoid_repetition
max_tokenssampling_temperatureresponse_format_typer   )default
   )urlr,   paramsretriestimeout)codemessage)r-   r   failr   INVALID_KEYr
   _default_modelurllibparseurljoin	_base_urlr   r   _get_retries_get_timeout_judge)
r   r%   r.   r/   r0   r,   rA   rB   rE   rF   s
             r#   checkzGooeyAIProvider.check=   s    ##%#0##K$;$;<<U2t22ll""4>>43G3GH p# / $$%$1
 %%a%0%%b%1
g {{g{66r$   c                 
    g dS )zList available GooeyAI models.)1
o1_previewo1_minigpt_4_or   chatgpt_4_ogpt_4_turbo_visiongpt_4_visiongpt_4_turbogpt_4	gpt_4_32kgpt_3_5_turbogpt_3_5_turbo_16kgpt_3_5_turbo_instructllama3_3_70bllama3_2_90b_visionllama3_2_11b_visionllama3_2_3bllama3_2_1bllama3_1_70bllama3_1_8b
llama3_70b	llama3_8bmixtral_8x7b_instruct_0_1gemma_2_9b_itgemma_7b_itgemini_1_5_flashgemini_1_5_progemini_1_pro_visiongemini_1_pro
palm2_chat
palm2_textclaude_3_5_sonnetclaude_3_opusclaude_3_sonnetclaude_3_haikuafrollama_v1$llama3_8b_cpt_sea_lion_v2_1_instruct	sarvam_2bllama_3_groq_70b_tool_usellama_3_groq_8b_tool_usellama2_70b_chatsea_lion_7b_instruct"llama3_8b_cpt_sea_lion_v2_instructtext_davinci_003text_davinci_002code_davinci_002text_curie_001text_babbage_001text_ada_001 )r   r%   r.   r/   s       r#   inspectzGooeyAIProvider.inspect\   s    2
 2	
r$   )N)r   r   r   )r   r   )__name__
__module____qualname____doc__r   r   r   strr   r   r-   r   rQ   r   __classcell__)r"   s   @r#   r   r      s    *
4	? 
.8# 88D> 8XVZ^ 873 7 7S 7c 7[f 7>5
S 5
3 5
s 5
DQTI 5
r$   r   r   )r   urllib.parserJ   typingr   r   r   
core.enumsr   core.modelsr   r   tools.coordinatorr	   tools.utilsr
   clientr   baser   registryr   r   r   r$   r#   <module>r      sE     ' ' " . ,     '}
n }
@ )_ -r$   