?????? AI? ???? ???? ???? ????? ???? ???, ???, ?? ?? ?? ??? ???? ??? ? ????. LangChain? ???? ??, ???? ??, ??? ? ?? ??? ?? ?? ?? ???? ?? Generative AI ?? ??? ????? ????????.
? ?????? LangChain ? Python? ???? Generative AI? ???? ? ??? ?? ??? ??? ?????.
1. ????? ??????
LangChain? OpenAI? GPT ?? Hugging Face ??? ?? ??? ?? ??(LLM)? ???? ??????? ???? ?? Python ?? ????????. ??? ???:
- ???? ??: ??? ???? ???? ????? ????.
- ?? ????: ?? LLM ??? ?? ????? ?????.
- ?? ??: AI ??? API, ?????? ?? ????? ? ??? ???.
- ??? ??: ??? ?? ????? ????? ?????.
2. ?? ??
a) ?? ????? ??
????? LangChain ? ?? ?????? ?????.
pip install langchain openai python-dotenv streamlit
b) OpenAI API ? ??
- OpenAI ??? ???? API ?? ????: OpenAI API.
- ???? ????? .env ??? ???? API ?? ?????.
OPENAI_API_KEY=your_api_key_here
- dotenv? ???? Python ????? API ?? ?????.
from dotenv import load_dotenv import os load_dotenv() openai_api_key = os.getenv("OPENAI_API_KEY")
3. LangChain? ?? ??
a) ????
AI? ??? ??? ????? ???? ???????. LangChain? ???? PromptTemplate? ???? ????? ????? ??? ? ????.
from langchain.prompts import PromptTemplate # Define a template template = "You are an AI that summarizes text. Summarize the following: {text}" prompt = PromptTemplate(input_variables=["text"], template=template) # Generate a prompt with dynamic input user_text = "Artificial Intelligence is a field of study that focuses on creating machines capable of intelligent behavior." formatted_prompt = prompt.format(text=user_text) print(formatted_prompt)
b) ?? ??
LangChain? OpenAI? GPT ?? Hugging Face ??? ?? LLM? ?????. OpenAI GPT?? ChatOpenAI? ?????.
from langchain.chat_models import ChatOpenAI # Initialize the model chat = ChatOpenAI(temperature=0.7, openai_api_key=openai_api_key) # Generate a response response = chat.predict("What is Generative AI?") print(response)
c) ??
??? ?? ??? ??? ?? ?? ???? ?????. ?? ?? ??? ??? ????.
- ??? ?????.
- ??? ???? ??? ?????.
from langchain.chains import LLMChain from langchain.prompts import PromptTemplate # Create a prompt and chain template = "Summarize the following text: {text}" prompt = PromptTemplate(input_variables=["text"], template=template) chain = LLMChain(llm=chat, prompt=prompt) # Execute the chain result = chain.run("Generative AI refers to AI systems capable of creating text, images, or other outputs.") print(result)
d) ??
???? ???? ??? ?? ?? ?? ??? ????? ??? ? ????. ??? ?????.
from langchain.chains import ConversationChain from langchain.memory import ConversationBufferMemory # Initialize memory and the conversation chain memory = ConversationBufferMemory() conversation = ConversationChain(llm=chat, memory=memory) # Have a conversation print(conversation.run("Hi, who are you?")) print(conversation.run("What did I just ask you?"))
4. ?? ??????
a) ??? ??
????? ???? ???? ???? ???? ?????.
from langchain.chat_models import ChatOpenAI from langchain.prompts import PromptTemplate chat = ChatOpenAI(temperature=0.9, openai_api_key=openai_api_key) prompt = PromptTemplate(input_variables=["topic"], template="Write a poem about {topic}.") chain = LLMChain(llm=chat, prompt=prompt) # Generate a poem result = chain.run("technology") print(result)
b) ??
??? ???? ????? ?????.
pip install langchain openai python-dotenv streamlit
c) ??
???? ??? ??? ??? ?????.
OPENAI_API_KEY=your_api_key_here
5. ?? ??
a) ??
??? ? ???? ??????? ?? ?? ??? ???? ? ??? ?????.
from dotenv import load_dotenv import os load_dotenv() openai_api_key = os.getenv("OPENAI_API_KEY")
b) ??? ??
?? ??? ???? ??? ?????? ?????.
from langchain.prompts import PromptTemplate # Define a template template = "You are an AI that summarizes text. Summarize the following: {text}" prompt = PromptTemplate(input_variables=["text"], template=template) # Generate a prompt with dynamic input user_text = "Artificial Intelligence is a field of study that focuses on creating machines capable of intelligent behavior." formatted_prompt = prompt.format(text=user_text) print(formatted_prompt)
6. Streamlit? ??? ??
Streamlit? ???? Generative AI ??? ?? ??? ? ?? ?????.
Streamlit ??:
from langchain.chat_models import ChatOpenAI # Initialize the model chat = ChatOpenAI(temperature=0.7, openai_api_key=openai_api_key) # Generate a response response = chat.predict("What is Generative AI?") print(response)
??? ?:
from langchain.chains import LLMChain from langchain.prompts import PromptTemplate # Create a prompt and chain template = "Summarize the following text: {text}" prompt = PromptTemplate(input_variables=["text"], template=template) chain = LLMChain(llm=chat, prompt=prompt) # Execute the chain result = chain.run("Generative AI refers to AI systems capable of creating text, images, or other outputs.") print(result)
? ??:
from langchain.chains import ConversationChain from langchain.memory import ConversationBufferMemory # Initialize memory and the conversation chain memory = ConversationBufferMemory() conversation = ConversationChain(llm=chat, memory=memory) # Have a conversation print(conversation.run("Hi, who are you?")) print(conversation.run("What did I just ask you?"))
7. ??? AI ???? ?? ?? ??
a) ?? ?? ??
??? ??????? GPT ?? Stable Diffusion? ?? ??? ?? ???? ??? ?????.
b) ??? ?????
??? ??? ?? ?? ???? ???? ??????.
c) ???? AI
???, ???, ?? ??? ??? ??(?: OpenAI? DALL·E ?? CLIP)? ?????.
d) ?? ? ??
???? ???? Docker? ?? ??? ???? ???? ??? ??? ?????.
8. ???
- LangChain ??: LangChain Docs
- OpenAI API: OpenAI Docs
- ?? ??? ??: ?? ???
? ???? ??? Python ? LangChain? ???? Generative AI ??????? ???? ? ??? ?? ??? ?? ? ????. ??? ????, ????? ????, ???? AI ??? ?? ? ?? ?????!
? ??? LangChain? Python? ??? ?? AI? ?? ???? ??? ??? - 3? ?? ?????. ??? ??? PHP ??? ????? ?? ?? ??? ?????!

? AI ??

Undress AI Tool
??? ???? ??

Undresser.AI Undress
???? ?? ??? ??? ?? AI ?? ?

AI Clothes Remover
???? ?? ???? ??? AI ?????.

Clothoff.io
AI ? ???

Video Face Swap
??? ??? AI ?? ?? ??? ???? ?? ???? ??? ?? ????!

?? ??

??? ??

???++7.3.1
???? ?? ?? ?? ???

SublimeText3 ??? ??
??? ??, ???? ?? ????.

???? 13.0.1 ???
??? PHP ?? ?? ??

???? CS6
??? ? ?? ??

SublimeText3 Mac ??
? ??? ?? ?? ?????(SublimeText3)

??? ??











Python? Unittest ? Pytest? ??? ? ???? ??, ?? ? ??? ????? ? ?? ?? ???? ??? ??? ?????. 1. ??? ??? ?? ??? ???? ??? ??? ??? ?????. UnitTest? ??? ??? ???? ???? Test \ _? ???? ???? ?????. Pytest? ? ?????. Test \ _?? ???? ?? ? ??????. 2. ??? ?? ?? ? ?? ? ??? ??? ????. UnitTest? Assertequal, AssertTrue ? ?? ??? ???? ?? Pytest? ??? Assert ?? ???? ?? ?? ??? ???? ?????. 3. ?? ??? ?? ? ?? ????? ????? ????.

pythonisidealfordataanalysisduetonumpyandpandas.1) numpyexcelsatnumericalcomputationsfast, multi-dimensionalArraysandectorizedOferationsLikenp.sqrt ()

?? ????? (DP)? ??? ??? ? ??? ?? ??? ??? ??? ? ??? ??? ?? ??? ???? ??? ????? ??????. ? ?? ?? ??? ????. 1. ??? (??) : ??? ?? ??? ???? ??? ???? ?? ??? ??????. 2. ??? (?) : ?? ???? ???? ????? ?????. ???? ???, ?? ?? ?? ?? ??/?? ?, ??? ??? ?? ?? ?? ??? ??? ????? ?????. ?????? ????? ?? ???? ?? ??? ? ???, ?? ??? ???? ?? ?? ??? ???? ??? ???? ????? ???? ???????.

??? ?? ???? ????? ????? __iter_ ? __next__ ???? ???????. ① __iter__ ???? ??? ? ?? ??? ???? ??? ?? ?? ??? ?????. ② __next__ ???? ? ??? ?? ????, ?? ??? ??? ????, ? ?? ??? ??? stopiteration ??? ??????. status ??? ???? ??????? ?? ??? ??? ?? ?? ??? ???????. pile ?? ?? ???? ?? ??? ?? ? ??? ?? ? ??? ?????? ?????. simple ??? ??? ?? ?? ??? ?? ???? ???? ?? ??? ? ??? ?? ????? ???? ??? ??? ???????.

Python? ?? ???? ?? ???, ?? ?? ????, ?? ???? ?? ? AI/ML ??? ???? ??? ?????. ??, Cpython? ???? ????? ?? ??, ?? ?? ??? ? ?? ? ?? ??? ?? ??? ??????. ??, ??? ????? ?? ?? ? ?? ??? ????? ?? ?? ? ? ??? ?? ?????. ??, Pyscript ? Nuitka? ?? ?? ???? ??? ??? ?? ??? ?????. ?????, AI ? ??? ?? ??? ?? ???? ??? ?? ???????? ???? ?? ? ??? ?????. ??? ??? Python? ??? ??? ????? ???? ?? ??? ???? ??? ?????.

Python? ?? ??? ???? ?????? ????, ????? ? ?? ??????? ???? ? ??? ??? ???? ?? ??? ?????. ?? TCP ??? ????? Socket.Socket ()? ???? ??? ??? ?? ? ??? ????? .listen ()? ???? ??? ?? .accept ()? ?? ????? ??? ???????. TCP ?????? ????? ?? ??? ??? ??? ????? .connect ()? ?? ? ?? .sendall ()? ???? ???? ??? .recv ()? ?? ??? ??????. ?? ?????? ????? 1. ??? : ??? ??? ? ???? ??? ? ????. 2. ??? I/O : ?? ??, Asyncio ?????? ? ??? ??? ?? ? ? ????. ???? ? ?

???? Python ?? ?? ?????? ?? ????, "??? ?????, ?? ??"? ???? ??? ??? ??? ?? ??? ?????. 1. ???? ?? ? ??? ?? ?????. ?? ???? ?? ??? ???? ??? ? ? ????. ?? ??, Spoke () ?? ???? ??? ??? ?? ??? ?? ????? ?? ??? ??? ????. 2. ???? ?? ???? ??? ??? ?????? Draw () ???? ???? ????? ?? ???? ?? ??? ???? ??? ???? ?? ?? ?? ??? ????? ?? ?? ????? ?? ?????. 3. Python ?? ???? ???????. ?? ???? ??? ???? ?? ???? ??? ????? ??? ?? ???? ??? ???? ????. ??? ??? ??? ???? ? ??? "?? ??"??????. 4. ???? ? ???? ?? ??? ?????

Python List ????? ?? ?? ??? [Start : End : Step] ??? ????? ??? ???? ????. 1. ?? ????? ?? ??? ?? [start : end : step]???. ??? ?? ??? (??), ?? ? ??? (???? ??)?? ??? ?? ?????. 2. ????? ???? 0?? ????? ???? ????? ??? ??? ???? ????? ??? 1? ??????. 3. my_list [: n]? ???? ? ?? n ??? ?? my_list [-n :]? ???? ??? n ??? ????. 4. My_List [:: 2]? ?? ??? ?? ?? ??? ???? ??? ??? ?? ?? ?? ??? ???? ? ????. 5. ???? ???? ? ???? ???? ????
