Weave
Browse files
app.py
CHANGED
@@ -14,16 +14,19 @@ from gtts import gTTS
|
|
14 |
from io import BytesIO
|
15 |
from together import Together
|
16 |
import time # For delay during index readiness check
|
|
|
17 |
|
18 |
# Pinecone and OpenAI setup
|
19 |
pinecone_api_key = os.getenv("PINECONE_API_KEY")
|
20 |
together_api_key = os.getenv("Together_ai_API")
|
21 |
openai.api_key = os.getenv("OpenAI_API")
|
22 |
master_prompt = os.getenv("MasterPrompt")
|
|
|
23 |
|
24 |
|
25 |
-
# Initialize Pinecone client
|
26 |
pc = Pinecone(api_key=pinecone_api_key)
|
|
|
27 |
|
28 |
# Create or retrieve Pinecone index
|
29 |
index_name = "farming-assistant"
|
@@ -51,6 +54,7 @@ denial_response = "Database scraping is not permitted. Please abide by the terms
|
|
51 |
# Initialize Together AI client
|
52 |
client = Together(api_key=together_api_key) # Updated Together client initialization
|
53 |
|
|
|
54 |
def generate_response(question):
|
55 |
# Generate a response using Together AI
|
56 |
response = client.chat.completions.create(
|
|
|
14 |
from io import BytesIO
|
15 |
from together import Together
|
16 |
import time # For delay during index readiness check
|
17 |
+
import weave
|
18 |
|
19 |
# Pinecone and OpenAI setup
|
20 |
pinecone_api_key = os.getenv("PINECONE_API_KEY")
|
21 |
together_api_key = os.getenv("Together_ai_API")
|
22 |
openai.api_key = os.getenv("OpenAI_API")
|
23 |
master_prompt = os.getenv("MasterPrompt")
|
24 |
+
WANDB_API_KEY = os.getenv("WANDB_API_KEY")
|
25 |
|
26 |
|
27 |
+
# Initialize Pinecone client and weave
|
28 |
pc = Pinecone(api_key=pinecone_api_key)
|
29 |
+
weave.init('NaturalFarmingChatbot')
|
30 |
|
31 |
# Create or retrieve Pinecone index
|
32 |
index_name = "farming-assistant"
|
|
|
54 |
# Initialize Together AI client
|
55 |
client = Together(api_key=together_api_key) # Updated Together client initialization
|
56 |
|
57 |
+
@weave.op()
|
58 |
def generate_response(question):
|
59 |
# Generate a response using Together AI
|
60 |
response = client.chat.completions.create(
|