File size: 1,451 Bytes
44e4510
 
 
 
 
 
 
 
 
 
 
65b8f24
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# Import the necessary libraries needed for the operation
import os
from langchain.llms import OpenAI
from langchain.prompts import PromptTemplate
from langchain.chains import LLMChain
from langchain.chains import SequentialChain
from secret_key import openapi_key

# Reading the OPEN API KEY
os.environ['OPENAI_API_KEY'] = openapi_key

# First chain of command: Name of the organization
def generate_name(feild):
    prompt_template = PromptTemplate(
        input_variables=["feild"],
        template="I want to open a edtech organization for {feild} domain. Suggest a great name for this and the course structure to be followed.",
    )
    
    name_chain = LLMChain(llm = model, prompt = prompt_template, output_key = "organization_name")
    
    # Second chain of command: Tips
    
    prompt_template = PromptTemplate(
        input_variables=["specifics"],
        template="Suggest me tips of how we can elevate the {specifics} for generative AI, and return it in comma seperated format",
    )
    
    specific_chain = LLMChain(llm = model, prompt = prompt_template, output_key = "tips")

    
    chain = SequentialChain(
    chains = [name_chain, specific_chain],
    input_variables = ["feild", "specifics"], # Added "specifics" to the input variables
    output_variables = ["organization_name", "tips"]
    )

    resp = chain({"feild" : feild})

    return resp


if __name__ == "__main__":
    print(generate_name("Data Science"))