a
    •˜ëj×B  ã                   @   s$  d Z ddlZddlmZmZ ddlmZ ddlmZ ddl	m
Z
 edœdd	„Zedœd
d„Zedœdd„Zedœdd„Zedœdd„Zedœdd„Zedœdd„Zedœdd„Zedœdd„Zedœdd„Zedœdd„Zedœdd„Zedœd d!„Zedœd"d#„Zedœd$d%„Zedœd&d'„Zedœd(d)„Zedœd*d+„Zedœd,d-„Zedœd.d/„Zedœd0d1„Zedœd2d3„Z edœd4d5„Z!edœd6d7„Z"edœd8d9„Z#edœd:d;„Z$edœd<d=„Z%edœd>d?„Z&edœd@dA„Z'edœdBdC„Z(edœdDdE„Z)edœdFdG„Z*edœdHdI„Z+edœdJdK„Z,edœdLdM„Z-edœdNdO„Z.edœdPdQ„Z/edœdRdS„Z0edœdTdU„Z1edœdVdW„Z2edœdXdY„Z3edœdZd[„Z4edœd\d]„Z5edœd^d_„Z6edœd`da„Z7edœdbdc„Z8edœddde„Z9edœdfdg„Z:edœdhdi„Z;edœdjdk„Z<edœdldm„Z=edœdndo„Z>edœdpdq„Z?edœdrds„Z@edœdtdu„ZAedœdvdw„ZBedœdxdy„ZCedœdzd{„ZDedœd|d}„ZEedœd~d„ZFedœd€d�„ZGedœd‚dƒ„ZHedœd„d…„ZIedœd†d‡„ZJedœdˆd‰„ZKedœdŠd‹„ZLedœdŒd�„ZMedœdŽd�„ZNedœd�d‘„ZOedœd’d“„ZPedœd”d•„ZQedœd–d—„ZRedœd˜d™„ZSedœdšd›„ZTedœdœd�„ZUedœdždŸ„ZVedœd d¡„ZWedœd¢d£„ZXedœd¤d¥„ZYedœd¦d§„ZZedœd¨d©„Z[edœdªd«„Z\edœd¬d­„Z]edœd®d¯„Z^edœd°d±„Z_e`ed²œd³d´„Zag dµ¢Zbece`eg ede f f dœd¶d·„ZedS )¸a®  **LLMs**.

**LLM** classes provide access to the large language model (**LLM**) APIs and services.

**Class hierarchy:**

.. code-block::

    BaseLanguageModel --> BaseLLM --> LLM --> <name>  # Examples: AI21, HuggingFaceHub, OpenAI

**Main helpers:**

.. code-block::

    LLMResult, PromptValue,
    CallbackManagerForLLMRun, AsyncCallbackManagerForLLMRun,
    CallbackManager, AsyncCallbackManager,
    AIMessage, BaseMessage
é    N)ÚAnyÚCallable)ÚLangChainDeprecationWarning)ÚBaseLLM)Úis_interactive_env)Úreturnc                  C   s   ddl m}  | S )Nr   ©ÚAI21)Zlangchain_community.llms.ai21r	   r   © r
   úV/mnt/bigstor/www/usecases/.venv/lib/python3.9/site-packages/langchain/llms/__init__.pyÚ_import_ai21   s    r   c                  C   s   ddl m}  | S )Nr   ©Ú
AlephAlpha)Z$langchain_community.llms.aleph_alphar   r   r
   r
   r   Ú_import_aleph_alpha$   s    r   c                  C   s   ddl m}  | S )Nr   ©ÚAmazonAPIGateway)Z+langchain_community.llms.amazon_api_gatewayr   r   r
   r
   r   Ú_import_amazon_api_gateway*   s    r   c                  C   s   ddl m}  | S )Nr   ©Ú	Anthropic)Z"langchain_community.llms.anthropicr   r   r
   r
   r   Ú_import_anthropic0   s    r   c                  C   s   ddl m}  | S )Nr   ©ÚAnyscale)Z!langchain_community.llms.anyscaler   r   r
   r
   r   Ú_import_anyscale6   s    r   c                  C   s   ddl m}  | S )Nr   ©ÚArcee)Zlangchain_community.llms.arceer   r   r
   r
   r   Ú_import_arcee<   s    r   c                  C   s   ddl m}  | S )Nr   ©ÚAviary)Zlangchain_community.llms.aviaryr   r   r
   r
   r   Ú_import_aviaryB   s    r   c                  C   s   ddl m}  | S )Nr   ©ÚAzureMLOnlineEndpoint)Z)langchain_community.llms.azureml_endpointr    r   r
   r
   r   Ú_import_azureml_endpointH   s    r!   c                  C   s   ddl m}  | S )Nr   ©ÚQianfanLLMEndpoint)Z/langchain_community.llms.baidu_qianfan_endpointr#   r"   r
   r
   r   Ú_import_baidu_qianfan_endpointN   s    r$   c                  C   s   ddl m}  | S )Nr   ©ÚBanana)Z"langchain_community.llms.bananadevr&   r%   r
   r
   r   Ú_import_bananadevT   s    r'   c                  C   s   ddl m}  | S )Nr   ©ÚBaseten)Z langchain_community.llms.basetenr)   r(   r
   r
   r   Ú_import_basetenZ   s    r*   c                  C   s   ddl m}  | S )Nr   ©ÚBeam)Zlangchain_community.llms.beamr,   r+   r
   r
   r   Ú_import_beam`   s    r-   c                  C   s   ddl m}  | S )Nr   ©ÚBedrock)Z langchain_community.llms.bedrockr/   r.   r
   r
   r   Ú_import_bedrockf   s    r0   c                  C   s   ddl m}  | S )Nr   ©ÚNIBittensorLLM)Z"langchain_community.llms.bittensorr2   r1   r
   r
   r   Ú_import_bittensorl   s    r3   c                  C   s   ddl m}  | S )Nr   ©ÚCerebriumAI)Z$langchain_community.llms.cerebriumair5   r4   r
   r
   r   Ú_import_cerebriumair   s    r6   c                  C   s   ddl m}  | S )Nr   ©ÚChatGLM)Z langchain_community.llms.chatglmr8   r7   r
   r
   r   Ú_import_chatglmx   s    r9   c                  C   s   ddl m}  | S )Nr   ©ÚClarifai)Z!langchain_community.llms.clarifair;   r:   r
   r
   r   Ú_import_clarifai~   s    r<   c                  C   s   ddl m}  | S )Nr   ©ÚCohere)Zlangchain_community.llms.coherer>   r=   r
   r
   r   Ú_import_cohere„   s    r?   c                  C   s   ddl m}  | S )Nr   ©ÚCTransformers)Z&langchain_community.llms.ctransformersrA   r@   r
   r
   r   Ú_import_ctransformersŠ   s    rB   c                  C   s   ddl m}  | S )Nr   ©ÚCTranslate2)Z$langchain_community.llms.ctranslate2rD   rC   r
   r
   r   Ú_import_ctranslate2�   s    rE   c                  C   s   ddl m}  | S )Nr   ©Ú
Databricks)Z#langchain_community.llms.databricksrG   rF   r
   r
   r   Ú_import_databricks–   s    rH   c                  C   s   ddl m}  | S )Nr   ©ÚChatDatabricks)Z*langchain_community.chat_models.databricksrJ   rI   r
   r
   r   Ú_import_databricks_chatœ   s    rK   c                  C   s   ddl m}  | S )Nr   ©Ú	DeepInfra)Z"langchain_community.llms.deepinfrarM   rL   r
   r
   r   Ú_import_deepinfra¢   s    rN   c                  C   s   ddl m}  | S )Nr   ©Ú
DeepSparse)Z#langchain_community.llms.deepsparserP   rO   r
   r
   r   Ú_import_deepsparse¨   s    rQ   c                  C   s   ddl m}  | S )Nr   ©ÚEdenAI)Zlangchain_community.llms.edenairS   rR   r
   r
   r   Ú_import_edenai®   s    rT   c                  C   s   ddl m}  | S )Nr   ©ÚFakeListLLM)Zlangchain_core.language_modelsrV   rU   r
   r
   r   Ú_import_fake´   s    rW   c                  C   s   ddl m}  | S )Nr   ©Ú	Fireworks)Z"langchain_community.llms.fireworksrY   rX   r
   r
   r   Ú_import_fireworksº   s    rZ   c                  C   s   ddl m}  | S )Nr   ©ÚForefrontAI)Z$langchain_community.llms.forefrontair\   r[   r
   r
   r   Ú_import_forefrontaiÀ   s    r]   c                  C   s   ddl m}  | S )Nr   ©ÚGigaChat)Z!langchain_community.llms.gigachatr_   r^   r
   r
   r   Ú_import_gigachatÆ   s    r`   c                  C   s   ddl m}  | S )Nr   ©Ú
GooglePalm)Z$langchain_community.llms.google_palmrb   ra   r
   r
   r   Ú_import_google_palmÌ   s    rc   c                  C   s   ddl m}  | S )Nr   ©ÚGooseAI)Z langchain_community.llms.gooseaire   rd   r
   r
   r   Ú_import_gooseaiÒ   s    rf   c                  C   s   ddl m}  | S )Nr   ©ÚGPT4All)Z langchain_community.llms.gpt4allrh   rg   r
   r
   r   Ú_import_gpt4allØ   s    ri   c                  C   s   ddl m}  | S )Nr   ©ÚGradientLLM)Z$langchain_community.llms.gradient_airk   rj   r
   r
   r   Ú_import_gradient_aiÞ   s    rl   c                  C   s   ddl m}  | S )Nr   ©ÚHuggingFaceEndpoint)Z-langchain_community.llms.huggingface_endpointrn   rm   r
   r
   r   Ú_import_huggingface_endpointä   s    ro   c                  C   s   ddl m}  | S )Nr   ©ÚHuggingFaceHub)Z(langchain_community.llms.huggingface_hubrq   rp   r
   r
   r   Ú_import_huggingface_hubê   s    rr   c                  C   s   ddl m}  | S )Nr   ©ÚHuggingFacePipeline)Z-langchain_community.llms.huggingface_pipelinert   rs   r
   r
   r   Ú_import_huggingface_pipelineð   s    ru   c                  C   s   ddl m}  | S )Nr   ©ÚHuggingFaceTextGenInference)Z7langchain_community.llms.huggingface_text_gen_inferencerw   rv   r
   r
   r   Ú&_import_huggingface_text_gen_inferenceö   s    rx   c                  C   s   ddl m}  | S )Nr   ©ÚHumanInputLLM)Zlangchain_community.llms.humanrz   ry   r
   r
   r   Ú_import_humanþ   s    r{   c                  C   s   ddl m}  | S )Nr   ©ÚJavelinAIGateway)Z+langchain_community.llms.javelin_ai_gatewayr}   r|   r
   r
   r   Ú_import_javelin_ai_gateway  s    r~   c                  C   s   ddl m}  | S )Nr   ©ÚKoboldApiLLM)Z!langchain_community.llms.koboldair€   r   r
   r
   r   Ú_import_koboldai
  s    r�   c                  C   s   ddl m}  | S )Nr   ©ÚLlamaCpp)Z!langchain_community.llms.llamacpprƒ   r‚   r
   r
   r   Ú_import_llamacpp  s    r„   c                  C   s   ddl m}  | S )Nr   ©ÚManifestWrapper)Z!langchain_community.llms.manifestr†   r…   r
   r
   r   Ú_import_manifest  s    r‡   c                  C   s   ddl m}  | S )Nr   ©ÚMinimax)Z langchain_community.llms.minimaxr‰   rˆ   r
   r
   r   Ú_import_minimax  s    rŠ   c                  C   s   ddl m}  | S )Nr   ©ÚMlflow)Zlangchain_community.llms.mlflowrŒ   r‹   r
   r
   r   Ú_import_mlflow"  s    r�   c                  C   s   ddl m}  | S )Nr   ©Ú
ChatMlflow)Z&langchain_community.chat_models.mlflowr�   rŽ   r
   r
   r   Ú_import_mlflow_chat(  s    r�   c                  C   s   ddl m}  | S )Nr   ©ÚMlflowAIGateway)Z*langchain_community.llms.mlflow_ai_gatewayr’   r‘   r
   r
   r   Ú_import_mlflow_ai_gateway.  s    r“   c                  C   s   ddl m}  | S )Nr   ©ÚModal)Zlangchain_community.llms.modalr•   r”   r
   r
   r   Ú_import_modal4  s    r–   c                  C   s   ddl m}  | S )Nr   ©ÚMosaicML)Z!langchain_community.llms.mosaicmlr˜   r—   r
   r
   r   Ú_import_mosaicml:  s    r™   c                  C   s   ddl m}  | S )Nr   ©ÚNLPCloud)Z!langchain_community.llms.nlpcloudr›   rš   r
   r
   r   Ú_import_nlpcloud@  s    rœ   c                  C   s   ddl m}  | S )Nr   ©ÚOctoAIEndpoint)Z(langchain_community.llms.octoai_endpointrž   r�   r
   r
   r   Ú_import_octoai_endpointF  s    rŸ   c                  C   s   ddl m}  | S )Nr   ©ÚOllama)Zlangchain_community.llms.ollamar¡   r    r
   r
   r   Ú_import_ollamaL  s    r¢   c                  C   s   ddl m}  | S )Nr   ©ÚOpaquePrompts)Z&langchain_community.llms.opaquepromptsr¤   r£   r
   r
   r   Ú_import_opaquepromptsR  s    r¥   c                  C   s   ddl m}  | S )Nr   ©ÚAzureOpenAI)Úlangchain_community.llms.openair§   r¦   r
   r
   r   Ú_import_azure_openaiX  s    r©   c                  C   s   ddl m}  | S )Nr   ©ÚOpenAI)r¨   r«   rª   r
   r
   r   Ú_import_openai^  s    r¬   c                  C   s   ddl m}  | S )Nr   ©Ú
OpenAIChat)r¨   r®   r­   r
   r
   r   Ú_import_openai_chatd  s    r¯   c                  C   s   ddl m}  | S )Nr   ©ÚOpenLLM)Z langchain_community.llms.openllmr±   r°   r
   r
   r   Ú_import_openllmj  s    r²   c                  C   s   ddl m}  | S )Nr   ©ÚOpenLM)Zlangchain_community.llms.openlmr´   r³   r
   r
   r   Ú_import_openlmp  s    rµ   c                  C   s   ddl m}  | S )Nr   ©ÚPaiEasEndpoint)Z)langchain_community.llms.pai_eas_endpointr·   r¶   r
   r
   r   Ú_import_pai_eas_endpointv  s    r¸   c                  C   s   ddl m}  | S )Nr   ©ÚPetals)Zlangchain_community.llms.petalsrº   r¹   r
   r
   r   Ú_import_petals|  s    r»   c                  C   s   ddl m}  | S )Nr   ©Ú
PipelineAI)Z#langchain_community.llms.pipelineair½   r¼   r
   r
   r   Ú_import_pipelineai‚  s    r¾   c                  C   s   ddl m}  | S )Nr   ©Ú	Predibase)Z"langchain_community.llms.predibaserÀ   r¿   r
   r
   r   Ú_import_predibaseˆ  s    rÁ   c                  C   s   ddl m}  | S )Nr   ©ÚPredictionGuard)Z(langchain_community.llms.predictionguardrÃ   rÂ   r
   r
   r   Ú_import_predictionguardŽ  s    rÄ   c                  C   s   ddl m}  | S )Nr   ©ÚPromptLayerOpenAI)Ú+langchain_community.llms.promptlayer_openairÆ   rÅ   r
   r
   r   Ú_import_promptlayer”  s    rÈ   c                  C   s   ddl m}  | S )Nr   ©ÚPromptLayerOpenAIChat)rÇ   rÊ   rÉ   r
   r
   r   Ú_import_promptlayer_chatš  s    rË   c                  C   s   ddl m}  | S )Nr   ©Ú	Replicate)Z"langchain_community.llms.replicaterÍ   rÌ   r
   r
   r   Ú_import_replicate   s    rÎ   c                  C   s   ddl m}  | S )Nr   ©ÚRWKV)Zlangchain_community.llms.rwkvrÐ   rÏ   r
   r
   r   Ú_import_rwkv¦  s    rÑ   c                  C   s   ddl m}  | S )Nr   ©ÚSagemakerEndpoint)Z+langchain_community.llms.sagemaker_endpointrÓ   rÒ   r
   r
   r   Ú_import_sagemaker_endpoint¬  s    rÔ   c                  C   s   ddl m}  | S )Nr   ©ÚSelfHostedPipeline)Z$langchain_community.llms.self_hostedrÖ   rÕ   r
   r
   r   Ú_import_self_hosted²  s    r×   c                  C   s   ddl m}  | S )Nr   ©ÚSelfHostedHuggingFaceLLM)Z1langchain_community.llms.self_hosted_hugging_facerÙ   rØ   r
   r
   r   Ú _import_self_hosted_hugging_face¸  s    rÚ   c                  C   s   ddl m}  | S )Nr   ©ÚStochasticAI)Z%langchain_community.llms.stochasticairÜ   rÛ   r
   r
   r   Ú_import_stochasticaiÀ  s    rÝ   c                  C   s   ddl m}  | S )Nr   ©ÚNebula)Z'langchain_community.llms.symblai_nebularß   rÞ   r
   r
   r   Ú_import_symblai_nebulaÆ  s    rà   c                  C   s   ddl m}  | S )Nr   ©ÚTextGen)Z langchain_community.llms.textgenrâ   rá   r
   r
   r   Ú_import_textgenÌ  s    rã   c                  C   s   ddl m}  | S ©Nr   ©ÚTitanTakeoff©Z&langchain_community.llms.titan_takeoffræ   rå   r
   r
   r   Ú_import_titan_takeoffÒ  s    rè   c                  C   s   ddl m}  | S rä   rç   rå   r
   r
   r   Ú_import_titan_takeoff_proØ  s    ré   c                  C   s   ddl m}  | S )Nr   ©ÚTogether)Z!langchain_community.llms.togetherrë   rê   r
   r
   r   Ú_import_togetherÞ  s    rì   c                  C   s   ddl m}  | S )Nr   ©ÚTongyi)Zlangchain_community.llms.tongyirî   rí   r
   r
   r   Ú_import_tongyiä  s    rï   c                  C   s   ddl m}  | S )Nr   ©ÚVertexAI)Ú!langchain_community.llms.vertexairñ   rð   r
   r
   r   Ú_import_vertexê  s    ró   c                  C   s   ddl m}  | S )Nr   ©ÚVertexAIModelGarden)rò   rõ   rô   r
   r
   r   Ú_import_vertex_model_gardenð  s    rö   c                  C   s   ddl m}  | S )Nr   ©ÚVLLM)Úlangchain_community.llms.vllmrø   r÷   r
   r
   r   Ú_import_vllmö  s    rú   c                  C   s   ddl m}  | S )Nr   ©Ú
VLLMOpenAI)rù   rü   rû   r
   r
   r   Ú_import_vllm_openaiü  s    rý   c                  C   s   ddl m}  | S )Nr   ©Ú
WatsonxLLM)Z#langchain_community.llms.watsonxllmrÿ   rþ   r
   r
   r   Ú_import_watsonxllm  s    r   c                  C   s   ddl m}  | S )Nr   ©ÚWriter)Zlangchain_community.llms.writerr  r  r
   r
   r   Ú_import_writer  s    r  c                  C   s   ddl m}  | S )Nr   ©Ú
Xinference)Z#langchain_community.llms.xinferencer  r  r
   r
   r   Ú_import_xinference  s    r  c                  C   s   ddl m}  | S )Nr   ©Ú	YandexGPT)Zlangchain_community.llms.yandexr  r  r
   r
   r   Ú_import_yandex_gpt  s    r	  c                  C   s   ddl m}  | S )Nr   ©ÚVolcEngineMaasLLM)Z(langchain_community.llms.volcengine_maasr  r
  r
   r
   r   Ú_import_volcengine_maas  s    r  )Únamer   c                 C   sT   ddl m} tƒ s*tjd| › d�dtd� | dkrJdd	„ tƒ  ¡ D ƒ}|S t|| ƒS )
Nr   )ÚllmszÑImporting LLMs from langchain is deprecated. Importing from langchain will no longer be supported as of langchain==0.2.0. Please import from langchain-community instead:

`from langchain_community.llms import zL`.

To install langchain-community run `pip install -U langchain-community`.é   )Ú
stacklevelÚcategoryÚtype_to_cls_dictc                 S   s   i | ]\}}||ƒ “qS r
   r
   )Ú.0ÚkÚvr
   r
   r   Ú
<dictcomp>1  s   z__getattr__.<locals>.<dictcomp>)	Zlangchain_communityr  r   ÚwarningsÚwarnr   Úget_type_to_cls_dictÚitemsÚgetattr)r  r  r  r
   r
   r   Ú__getattr__   s    ýù
ÿr  )Qr	   rÐ   rø   r   r   r   r   r   r   r    r§   r&   r)   r,   r/   rA   rD   r5   r8   r;   r>   rG   rM   rP   rS   rV   rY   r\   rh   r_   rb   re   rk   rn   rq   rt   rw   rz   r}   r€   rƒ   r†   r‰   r’   r•   r˜   r2   r›   rß   rž   r¡   r¤   r«   r®   r±   r´   r·   rº   r½   rÀ   rÃ   rÆ   rÊ   r#   rÍ   rÓ   rÙ   rÖ   rÜ   râ   ræ   ZTitanTakeoffProrî   rü   rñ   rõ   r  rÿ   r  r  r  c                P   C   s¤   t ttttttttt	t
tttttttttttttttttttttt t!t"t#t$t%t&t't(t)t*t+t,t-t.t/t0t1t2t3t4t5t6t7t8t9t:t;t<t=t>t?t@tAtBtCtDtDtEtFtGtHtItJtKtLtMdœOS )N)OZai21Zaleph_alphaZamazon_api_gatewayZamazon_bedrockZ	anthropicZanyscaleZarceeZaviaryZazureZazureml_endpointZ	bananadevZbasetenZbeamZcerebriumaiZchat_glmZclarifaiZcohereZctransformersZctranslate2Z
databrickszdatabricks-chatZ	deepinfraZ
deepsparseZedenaiz	fake-listZforefrontaizgiga-chat-modelZgoogle_palmZgooseaiZgradientZgpt4allZhuggingface_endpointZhuggingface_hubZhuggingface_pipelineZhuggingface_textgen_inferencezhuman-inputZkoboldaiZllamacppZtextgenZminimaxZmlflowzmlflow-chatzmlflow-ai-gatewayÚmodalZmosaicZnebulaZnibittensorZnlpcloudZollamaZopenaiZopenlmZpai_eas_endpointZpetalsZ
pipelineaiZ	predibaseZopaquepromptsZ	replicateZrwkvZsagemaker_endpointZself_hostedZself_hosted_hugging_faceZstochasticaiZtogetherZtongyiZtitan_takeoffZtitan_takeoff_proZvertexaiZvertexai_model_gardenZopenllmZopenllm_clientZvllmZvllm_openaiZ
watsonxllmÚwriterZ
xinferencezjavelin-ai-gatewayZqianfan_endpointZ
yandex_gptr  )Nr   r   r   r0   r   r   r   r   r©   r!   r'   r*   r-   r6   r9   r<   r?   rB   rE   rH   rK   rN   rQ   rT   rW   r]   r`   rc   rf   rl   ri   ro   rr   ru   rx   r{   r�   r„   rã   rŠ   r�   r�   r“   r–   r™   rà   r3   rœ   r¢   r¬   rµ   r¸   r»   r¾   rÁ   r¥   rÎ   rÑ   rÔ   r×   rÚ   rÝ   rì   rï   rè   ré   ró   rö   r²   rú   rý   r   r  r  r~   r$   r	  r  r
   r
   r
   r   r  �  s     ±r  )fÚ__doc__r  Útypingr   r   Zlangchain_core._apir   Z#langchain_core.language_models.llmsr   Zlangchain._api.interactive_envr   r   r   r   r   r   r   r   r!   r$   r'   r*   r-   r0   r3   r6   r9   r<   r?   rB   rE   rH   rK   rN   rQ   rT   rW   rZ   r]   r`   rc   rf   ri   rl   ro   rr   ru   rx   r{   r~   r�   r„   r‡   rŠ   r�   r�   r“   r–   r™   rœ   rŸ   r¢   r¥   r©   r¬   r¯   r²   rµ   r¸   r»   r¾   rÁ   rÄ   rÈ   rË   rÎ   rÑ   rÔ   r×   rÚ   rÝ   rà   rã   rè   ré   rì   rï   ró   rö   rú   rý   r   r  r  r	  r  Ústrr  Ú__all__ÚdictÚtyper  r
   r
   r
   r   Ú<module>   sº   U