OwlCyberSecurity - MANAGER
Edit File: cohere.cpython-312.pyc
� G��g2$ � �F � d dl mZ d dlmZ d dlmZ d dlmZ d dlm Z d dl mZ erd dl mZm Z mZ d dlmZ d d lZd d lmZ d dlmZmZ d dlmZmZ d d lmZ d dlmZ d dlmZmZ erd dlm Z d dlm"Z" ejH ejJ ejL ejN ejP ejR ejT d�Z+ejX ejZ d�Z.dddd�Z/dddddd�Z0 G d � d!e� Z1d"� Z2d#� Z3d$� Z4y # e!$ r ed� �w xY w# e!$ r d dlm#Z" Y ��w xY w)%� ��wraps)�consts)�record_token_usage)�SPANDATA)�set_data_normalized)� TYPE_CHECKING)�Any�Callable�Iterator)�SpanN)�should_send_default_pii)�DidNotEnable�Integration)�capture_internal_exceptions�event_from_exception)�Client)� BaseCohere)�ChatStreamEndEvent�NonStreamedChatResponse)�StreamedChatResponsezCohere not installed)�StreamEndStreamedChatResponse)�StreamedChatResponse_StreamEnd)�model�k�p�seed�frequency_penalty�presence_penalty� raw_prompting)�tools�preamblezai.generation_idzai.is_search_requiredzai.finish_reason)� generation_id�is_search_required� finish_reasonzai.citationszai.documentszai.search_querieszai.search_resultsz ai.tool_calls)� citations� documents�search_queries�search_results� tool_callsc �2 � e Zd ZdZde� �Zdd�Zed� � Zy)�CohereIntegration�coherezauto.ai.c � � || _ y )N)�include_prompts)�selfr/ s �M/opt/hc_python/lib/python3.12/site-packages/sentry_sdk/integrations/cohere.py�__init__zCohereIntegration.__init__I s � �.��� c �� � t t j d�� t _ t t j � t _ t t j d�� t _ y )NF)� streamingT)� _wrap_chatr �chat�_wrap_embedr �embed�chat_stream� r3 r1 � setup_oncezCohereIntegration.setup_onceM s; � � %�Z�_�_��F� ��"�6�<�<�0���!+�J�,B�,B�d�!S� �r3 N)T)�__name__� __module__�__qualname__� identifier�originr2 �staticmethodr<