DKethan commited on
Commit
b8693de
·
verified ·
1 Parent(s): 0565bee

Create healper.py

Browse files
Files changed (1) hide show
  1. healper.py +36 -0
healper.py ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import os
3
+ import pandas as pd
4
+ from together import Together
5
+
6
+
7
+ client = Together(api_key=os.environ["TOGETHER_API_KEY"])
8
+
9
+
10
+ def call_llama(prompt: str) -> str:
11
+ """
12
+ Send a prompt to the Llama model and return the response.
13
+ Args:
14
+ prompt (str): The input prompt to send to the Llama model.
15
+ Returns:
16
+ str: The response from the Llama model.
17
+ """
18
+
19
+ # Create a completion request with the prompt
20
+ response = client.chat.completions.create(
21
+
22
+ # Use the Llama-3-8b-chat-hf model
23
+ model="meta-llama/Llama-3-8b-chat-hf",
24
+
25
+ # Define the prompt as a user message
26
+ messages=[
27
+ {
28
+ "role": "user",
29
+ "content": prompt # Use the input prompt
30
+ }
31
+ ],
32
+ temperature=0.7,
33
+ )
34
+
35
+ # Return the content of the first response message
36
+ return response.choices[0].message.content