Spaces:
Sleeping
Sleeping
Delete test_langchain.py
Browse files- test_langchain.py +0 -26
test_langchain.py
DELETED
@@ -1,26 +0,0 @@
|
|
1 |
-
from langchain.llms import OpenAI
|
2 |
-
from langchain.chains import LLMChain
|
3 |
-
from langchain.prompts import PromptTemplate
|
4 |
-
import os
|
5 |
-
from dotenv import load_dotenv
|
6 |
-
|
7 |
-
# .env faylından API açarını yüklə
|
8 |
-
load_dotenv()
|
9 |
-
openai_api_key = os.getenv("OPENAI_API_KEY")
|
10 |
-
|
11 |
-
# LLM obyekti yarat (OpenAI)
|
12 |
-
llm = OpenAI(temperature=0.7, openai_api_key=openai_api_key)
|
13 |
-
|
14 |
-
# Prompt (sual şablonu) yarat
|
15 |
-
prompt = PromptTemplate(
|
16 |
-
input_variables=["name"],
|
17 |
-
template="What would be a good company name for a company that makes {name}?"
|
18 |
-
)
|
19 |
-
|
20 |
-
# Chain yaradaraq LLM ilə promptu birləşdir
|
21 |
-
chain = LLMChain(llm=llm, prompt=prompt)
|
22 |
-
|
23 |
-
# Chain-i işə sal
|
24 |
-
response = chain.run("colorful socks")
|
25 |
-
|
26 |
-
print(response)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|