LangChain ? Llama3? ???? ?? ??? ??: AI ???? ??
?? AI ????? ??? LLM(?? ?? ??) ?? ??? ?? ?? ????? ? ?? ??? ?? ??? ????. LangChain? AI ?? ?????? ??? ???? ?? ?? ??? ???? LLM ?? ??? ???? ?? ???? ?? ?? ??? ??? ?????. ??? LLM ??? ???? ????? ???? ?????? ??? ???? ??? ?? ???????. ?? LangChain? ??? Llama3 ??? ???? ?? ?? ????? ?? ??? ??? ?? ?? ???? ????? ??????.
LangChain? ??? ??
LangChain? ??? ??? ???? ?? ????? ???? ?? ??? ???? LLM? ?? ???? ??? ??????. ? ?? ??? ?? ??? ???? ? ??? ?? ???? ??????. ?? API ??? ????? ????? ???? ???? ?? ?????? ??? ???? ????? ???? ??? ?????? ?????. ?? ????? ????? ??? ??? LLM ??????? ?? ????? ?? ???? ?? ??? ????.
LangChain? ?? ?? ??
????? LangChain? ? ??? ??? ???? ?? ?? ???? ??? ??? ??? ?????. ??? ??? ???? ?? ???? ?? ?? ???? ?? ??? ?????. ??????? ????? ???? ?? ?? ??? ?? ????? ???? ?? ??? ???? ???? ??? ?? ???? ?? ? ???? ??? ?? ??? ? ????.
?? ???
? ?????? ?? ??, ??, ??, ?? ?? ? ?? ????? ???? ??? ??? ??? ? ?? ???? ???? ???? ?????. Ollama? ?? ???? Llama3 ??? ? ??? ?? ??? ???? ??? ??? ??????.
????
??? ?????.
- ?? ??? ???? ??????.
pip install langchain langchain-ollama requests
- ?? ?? Ollama? ??????.
- https://ollama.com/blog/llama3?? Ollama? ?????? ??????.
- ? ????? Ollama ??? ??????.
ollama serve
- Llama3 ??? ??????.
ollama pull llama3
?? ???? ???? ?? Ollama ??? ????? ???? ??? ???. ?? ??? ???? ??? ??? ? ????.
?? ?? ?? ??
???? ? ??? ??? ????? ???????.
?? ??
? ??? ??? ?? ??? ??? ???? ??? ??? ???? ? ??? ???. Ollama ?? ??? ???? ??? ? ?? ?????:
pip install langchain langchain-ollama requests
?? ??
??? ????? ??? ??? ???? ?? ??? ?????.
ollama serve
??? ????? ?? ??? ?? ??? ??? ???? ? ?? ?? ??? ??? ???????.
??(0.7): ??? ????? ?????. ?? ????(?: 0.3) ???? ? ?? ?????, ?? ????(?: 0.9) ???? ???. 0.7? ???? ????.
Top_p(0.9): ? ??????? ?? ? ????? ???? ? ?? ?? ?? ??? ?????. 0.9??? ??? ????? ???? ???? ????? ??? ??? ?????.
num_ctx(4096): ???? ? ?? ?? ??? ? ?? ??? ? ?? ???? ????. ?? ?? 3000-3500 ??? ??? ? ???? ?? ? ??? ?? ?? ??? ??? ??? ?????.
??? ?????
???? ???? ???? ??? ?? ???? ????.
ollama pull llama3
?? ?????
LangChain? ?? ??? ?? ? ??? ??? ?? ?????.
def check_ollama_connection(): """ Check if Ollama server is running """ try: requests.get('http://localhost:11434/api/tags') return True except requests.exceptions.ConnectionError: return False
? ? ?? ???? ?? ??, ?? ?? ?? ? ?? ??? ???? ??? ?? ?????? ?????.
??? ?????
??? ???? ??? ??? ?? ??? ?????? ??????.
llm = OllamaLLM( model="llama3", temperature=0.7, # Balances creativity and consistency top_p=0.9, # Helps with text diversity num_ctx=4096 # Sets the context window )
?? ???
???? ???? ?? ?????. ??? ???? ????? ???? ???.
?? #1
article_template = """ You are a professional content writer tasked with creating a comprehensive article. Topic: {topic} Writing Requirements: 1. Length: Approximately {word_count} words 2. Style: {tone} tone 3. Target Audience: {audience} 4. Format: Plain text without any markdown notation 5. Additional Details/Requirements: {extra_details} Content Structure Guidelines: - Start with an engaging introduction that hooks the reader - Organize content into clear sections with descriptive headings (not numbered) - Include relevant examples, statistics, or case studies when appropriate - Provide practical insights and actionable takeaways - End with a compelling conclusion that summarizes key points - Ensure smooth transitions between paragraphs and sections Writing Style Guidelines: - Use clear, concise language appropriate for the target audience - Avoid jargon unless necessary for the target audience - Incorporate relevant examples and real-world applications - Maintain an engaging and natural flow throughout the article - Use active voice predominantly - Include specific details and evidence to support main points - Ensure proper paragraph breaks for readability Additional Notes: - Do not use any markdown formatting - Keep paragraphs concise and focused - Use proper spacing between sections - If technical terms are used, provide brief explanations - Include a brief overview of what will be covered at the start Please write the article now: """
??? ??:
chain = prompt | llm
?? #2
def parse_arguments(): """ Parse command line arguments """ parser = argparse.ArgumentParser(description='Generate an article using AI') parser.add_argument('--topic', type=str, required=True, help='The topic of the article') parser.add_argument('--word-count', type=int, default=800, help='Target word count (default: 800)') parser.add_argument('--tone', type=str, default='professional', choices=['professional', 'casual', 'academic', 'informative', 'technical'], help='Writing tone (default: professional)') parser.add_argument('--audience', type=str, default='general', help='Target audience (default: general)') parser.add_argument('--extra-details', type=str, default='', help='Additional requirements or details for the article') return parser.parse_args()
??? ??:
python main.py \ --topic "Benefits of playing board games with friends" \ --word-count 200 \ --tone casual \ --audience "Board games lovers" \ --extra-details "Avoid markdown notation"
?? ?? ??
? ????? ?? ?? LangChain?? ??? ?? ? ?? ??? ???? ??????.
- ?? ??: 1??? ?? ???? ?? ??? ? ?? ???? ?? ??? ?? ? ????.
- ???? ??: 4096 ?? ???? ?? ??? ??? ????? ???? ??? ??? ??? ?????.
- ?? ????: ??(0.7) ? top_p(0.9) ??? ???? ??? ??? ??? ??? ?????.
?? ??
? ?? ???? ?????? AI ???? LangChain? ???? ??? ???????. LLM ?? ??? ???? ???? ??? ???? ??? ??? ???? ? ??? ? ?? ??? ?????. ?????? ???? ?? ??? ??? ???? ???? AI ?? ??????? ? ?? ?? ? ??? ????.
?? ??? ??? ??? ???? ??? LangChain? ??? ??? ?? ??? ????? ????, ?? ?? ?? ???? ???? ???? ????. AI ?? ??? ??????? ???? ??? ?? ???? LangChain? ?? ?????? ????? ?? ??? ??????? ???? ? ?? ??? ?? ????.
???? ??? ???? LangChain ???? ??? ??? ?? ????. ???? LLM? ??? ??? ???? ????? ??? ??? "???? ???"?? ??? ??? ?????. ?? ??? ?????? ?? ?? "???"? ??? ???????? "??"?? ? ??? ??? ???? ?? ???? ?????.
? ??? LangChain ? LlamaAn AI Developers Journey? ?? ??? ??? ?? ?????. ??? ??? 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 ?? ?? ?????? ?? ????, "??? ?????, ?? ??"? ???? ??? ??? ??? ?? ??? ?????. 1. ???? ?? ? ??? ?? ?????. ?? ???? ?? ??? ???? ??? ? ? ????. ?? ??, Spoke () ?? ???? ??? ??? ?? ??? ?? ????? ?? ??? ??? ????. 2. ???? ?? ???? ??? ??? ?????? Draw () ???? ???? ????? ?? ???? ?? ??? ???? ??? ???? ?? ?? ?? ??? ????? ?? ?? ????? ?? ?????. 3. Python ?? ???? ???????. ?? ???? ??? ???? ?? ???? ??? ????? ??? ?? ???? ??? ???? ????. ??? ??? ??? ???? ? ??? "?? ??"??????. 4. ???? ? ???? ?? ??? ?????

ListSlicingInpyTonextractSapalistusingIndices.1.itusesthesyntaxlist [start : end : step], wherestartisinclusive, endisexclusive, andstepdefinestheinterval.2.ifstartorendareomitted, pythondefaultstothebeginningorendofthtlist.3

??? ???? @ClassMethod ?????? ?? ????? ?? ? ??????. ? ?? ?? ??? ??? ?? (CLS)?? ??? ??? ?????? ???? ? ?????. ?? ????? ?? ?? ???? ??? ??? ??? ?? ????? ?? ?? ? ? ????. ?? ??, ?? ????? show_count () ???? ?? ? ?? ?? ?????. ??? ???? ?? ? ?? @ClassMethod ?????? ???? ??? ??? ???? ?? Change_var (new_value) ???? ?? ? ?? ?? ?? CLS? ???????. ??? ???? ???? ?? (?? ?? ??) ? ?? ??? (?? ?? ?? ??)? ??? ?? ??, ?? ??? ? ??? ?? ??? ?????. ???? ??? ??? ????.

?? ??? ??? ?? ? ? ?? ?? ??? ??? ?? ? ? ?? ?? ?????. 1. ?? ?? ??? ???? ??????, ??? ??? ???? ??? ?????. 2. ??? ?? ??? ?? ?? ???? ???? ??? ???? ???? ???? ? ????. 3. ?? ?? ?? ?? ?? ??? ??? ?? ?? ? ? ????? ?? ??? ????? ??????. 4. Args? *Kwargs? ???? ?? ?? ??? ?? ? ? ????? ???? ????? ?? ?????? ????? ???? ???? ?????? ???????.

Python? CSV ??? CSV ??? ?? ?? ?? ??? ?????. 1. CSV ??? ?? ? CSV.Reader ()? ???? ? ?? ?? ? ??? ??? ??? ???? ?? ? ? ????. ? ??? ?? ???? ??? ???? ?? csv.dictreader ()? ???? ? ?? ??? ?? ? ? ????. 2. CSV ??? ? ? CSV.writer ()? ???? Writerow () ?? Writerows () ???? ???? ?? ?? ?? ?? ???? ??????. ?? ???? ????? CSV.DictWriter ()? ????? ?? ? ??? ???? writeHeader ()? ?? ??? ???????. 3. ?? ???? ?? ? ? ??? ???? ?????.

???? __iter __ () ? __next __ () ???? ???? ?????. ???? ??? ? ??? ????, ?? ???? ?? ??? ??? ???? ?????. 1. ???? ?? () ?? ? ??? ??? ???? ? ?? ??? ?? ? ?? ???? ??? ????. 2. ???? ?? ??? ???? ??? ???? ???? ???? ???? ?? ???? ?????. 3. ???? ???? ?? ??? ?? ? ? ? ??? ?? ? ???????? ? ? ??? ?? ??? ??? ???? ?? ? ? ???? ??????. ?? : ??? ?? ???? ??? ???? ????. ???? ?? ?? ? ??? ?????? ???? ? ?? ?? ? ? ????.

? ??? ???? ???? ?? ??? ??? ??? ??? ???? ???? ???? ? ????. 1. ?? ? ??? ?? ???? List1 List2? ?? ? ??? ?????. 2. ?? = List1 = list2? ?? ?? ??? ?????. 3. list1.extend (list2)? ?? ?? ???? ????? extend () ???? ??????. 4. ??? ???? ??? ?? ?? (Python3.5)? ???? [List1,*List2]? ?? ?? ??? ??? ?? ?? ?? ??? ?????. ?? ??? ?? ????? ???? ?? ??? ??? ??? ???? ??? ???? ???????.

????? ??? ????? ?? ??? ??? ?? ?? ??? ?? ??? ???????. 1. defgreet () : print ( "hello, world!")? ?? ??? ????? DEF ???? ??????. 2. greet ()? ?? ?? ??? ??? ???? ??? ??????. 3. ??? ?? ??? ??? ?? DefGreet (name) : print (f "hello, {name}!") ? greet ( "Alice")? ?? ?? ? ? ?? ?? ?? ?? ??????. 4. defadd (a, b)? ?? ?? ?? ??? ??? ? ????. ?? = a
