CoolFace
Apppublic

IR-IIITH/MultiAgent-OpenDomain-QnA-System

sourceHugging Faceupdated 2y agoView on Hugging Face
1likes
getAnswer.cpython-312.pyc17 linesDownload Raw Back to __pycache__
1�

2��;g���,�ddlZddlZddlmZd�Zd�Zy)�N)�Togetherc�V�tdd�5}tj|�}ddd�jd�}t	|��}d|�d|�d�}|j3jjdd	|d4�g��}|jdjjS#1swY�}xYw)
N�config.json�r�TOGETHER_AI��api_keyzmConsider the context and generate a brief 1-2 line answer to the question. Output only the answer.5 6Context: z7 8Question: �9z+meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo�user��role�content��model�messagesr��open�json�load�getr�chat�completions�create�choices�messager)�question�context�file�config�together_ai_key�client�prompt�responses        �i/home/yash/Desktop/Sem7/IRE/Project/MultiAgent-OpenDomain-QnA-System (Copy)/AnswerGeneration/getAnswer.py�generate_answer_withContextr%s���	
�m�S�	!�!�T����4���!��j�j��/�O�
�o�
.�F�10�11����*��	�F��{�{�&�&�-�-�;�!�f�5�6�.��H����A��&�&�.�.�.�'!�!�s�B�B(c�P�tdd�5}tj|�}ddd�jd�}t	|��}d|�d�}|j12jjdd|d	�g�13�}|jdjjS#1swY�zxYw)Nrrrrz*Answer the following question:14 15Question: r16zmeta-llama/Llama-3-8b-chat-hfrrrrr)rrrr r!r"r#s       r$�generate_answer_zeroShotr's���	
�m�S�	!�!�T����4���!��j�j��/�O�
�o�
.�F���*���F��{�{�&�&�-�-�-�!�f�5�6�.��H�17���A��&�&�.�.�.�!!�!�s�B�B%)�osr�togetherrr%r'��r$�<module>r,s��	���/�./r+