o
    i	                     @   sx   d dl mZ ddlmZmZmZmZmZmZ ee	e
ee	 ee
 f Zeed ef ZG dd deZG dd deZd	S )
   )CohereObject    )AnyDictIteratorListLiteralUnion)
prediction
confidencetextc                   @   sn   e Zd Zdeeef ddfddZdefddZe	defdd	Z
e	dee fd
dZe	defddZdS )ClassificationclassificationreturnNc                 C   s
   || _ d S N)r   )selfr    r   z/var/www/html/karishye-ai-python/venv/lib/python3.10/site-packages/cohere/manually_maintained/cohere_aws/classification.py__init__	   s   
zClassification.__init__c                 C   s4   t | jtrdS t | jttfrdS t | jd tS )NTFr
   
isinstancer   listintstrr   r   r   r   is_multilabel   s
   zClassification.is_multilabelc                 C   s"   t | jtttfr| jS | jd S )Nr
   r   r   r   r   r   r
      s   
zClassification.predictionc                 C   $   t | jtttfrtd| jd S )NzlConfidence scores are not available for version prior to 2.0 of Cohere Classification Finetuning AWS packager   r   r   r   r   r   
ValueErrorr   r   r   r   r      
   
zClassification.confidencec                 C   r   )NzgOriginal text is not available for version prior to 2.0 of Cohere Classification Finetuning AWS packager   r   r   r   r   r   r   $   r   zClassification.text)__name__
__module____qualname__r	   
PredictionClassificationDictr   boolr   propertyr
   r   floatr   r   r   r   r   r   r   r      s    r   c                   @   sL   e Zd Zdee ddfddZdefddZdefdd	Z	de
fd
dZdS )Classificationsclassificationsr   Nc                    s<   | _ t j dkrt fdd j D sJ dd S d S )Nr   c                    s   g | ]
}|     kqS r   )r   ).0cr   r   r   
<listcomp>2   s    z,Classifications.__init__.<locals>.<listcomp>zJAll classifications must be of the same type (single-label or multi-label))r)   lenall)r   r)   r   r   r   r   .   s   zClassifications.__init__c                 C   
   t | jS r   )iterr)   r   r   r   r   __iter__5      
zClassifications.__iter__c                 C   r/   r   )r-   r)   r   r   r   r   __len__8   r2   zClassifications.__len__c                 C   s   t | jdko| jd  S )Nr   )r-   r)   r   r   r   r   r   r   ;   s   zClassifications.is_multilabel)r    r!   r"   r   r   r   r   r1   r   r3   r%   r   r   r   r   r   r(   -   s
    r(   N)responser   typingr   r   r   r   r   r	   r   r   r#   r$   r   r(   r   r   r   r   <module>   s     %