{"id":73055,"date":"2024-08-11T12:08:37","date_gmt":"2024-08-11T08:38:37","guid":{"rendered":"https:\/\/nabfollower.com\/blog\/building-a-generative-ai-platform-a-deep-dive-into-architecture-and-implementation-36hk\/"},"modified":"2024-08-11T12:08:37","modified_gmt":"2024-08-11T08:38:37","slug":"building-a-generative-ai-platform-a-deep-dive-into-architecture-and-implementation-36hk","status":"publish","type":"post","link":"https:\/\/nabfollower.com\/blog\/building-a-generative-ai-platform-a-deep-dive-into-architecture-and-implementation-36hk\/","title":{"rendered":"\u0633\u0627\u062e\u062a\u0646 \u067e\u0644\u062a\u0641\u0631\u0645 \u0647\u0648\u0634 \u0645\u0635\u0646\u0648\u0639\u06cc \u0645\u0648\u0644\u062f: \u0634\u06cc\u0631\u062c\u0647 \u0627\u06cc \u0639\u0645\u06cc\u0642 \u062f\u0631 \u0645\u0639\u0645\u0627\u0631\u06cc \u0648 \u067e\u06cc\u0627\u062f\u0647 \u0633\u0627\u0632\u06cc"},"content":{"rendered":"<p>Summarize this content to 400 words in Persian Lang<br \/>\n            \u0628\u0647 \u0639\u0646\u0648\u0627\u0646 \u06cc\u06a9 \u062a\u0648\u0633\u0639\u0647 \u062f\u0647\u0646\u062f\u0647 \u062f\u0631 \u0641\u0636\u0627\u06cc \u0647\u0648\u0634 \u0645\u0635\u0646\u0648\u0639\u06cc\u060c \u062f\u0631\u06a9 \u0645\u0639\u0645\u0627\u0631\u06cc \u067e\u0644\u062a\u0641\u0631\u0645 \u0647\u0627\u06cc \u0647\u0648\u0634 \u0645\u0635\u0646\u0648\u0639\u06cc \u0645\u0648\u0644\u062f \u0628\u0633\u06cc\u0627\u0631 \u0645\u0647\u0645 \u0627\u0633\u062a. \u0627\u06cc\u0646 \u0633\u06cc\u0633\u062a\u0645 \u0647\u0627 \u062f\u0631 \u062e\u0637 \u0645\u0642\u062f\u0645 \u0628\u0631\u0646\u0627\u0645\u0647 \u0647\u0627\u06cc \u0645\u062f\u0631\u0646 \u0647\u0648\u0634 \u0645\u0635\u0646\u0648\u0639\u06cc \u0642\u0631\u0627\u0631 \u062f\u0627\u0631\u0646\u062f \u0648 \u0642\u0627\u062f\u0631 \u0628\u0647 \u062a\u0648\u0644\u06cc\u062f \u0645\u062a\u0646\u060c \u062a\u0635\u0627\u0648\u06cc\u0631 \u0648 \u063a\u06cc\u0631\u0647 \u0634\u0628\u06cc\u0647 \u0627\u0646\u0633\u0627\u0646 \u0647\u0633\u062a\u0646\u062f. \u062f\u0631 \u0627\u06cc\u0646 \u0645\u0642\u0627\u0644\u0647\u060c \u062c\u0646\u0628\u0647 \u0647\u0627\u06cc \u0641\u0646\u06cc \u0633\u0627\u062e\u062a \u0686\u0646\u06cc\u0646 \u067e\u0644\u062a\u0641\u0631\u0645\u06cc \u0631\u0627 \u0628\u0627 \u062a\u0645\u0631\u06a9\u0632 \u0628\u0631 \u0627\u062c\u0632\u0627\u06cc \u06a9\u0644\u06cc\u062f\u06cc \u0648 \u0627\u062c\u0631\u0627\u06cc \u0622\u0646\u0647\u0627 \u0628\u0631\u0631\u0633\u06cc \u062e\u0648\u0627\u0647\u06cc\u0645 \u06a9\u0631\u062f.<\/p>\n<p>\u0645\u0631\u0648\u0631\u06cc \u0628\u0631 #\u0645\u0639\u0645\u0627\u0631\u06cc\u06cc\u06a9 \u067e\u0644\u062a\u0641\u0631\u0645 \u0647\u0648\u0634 \u0645\u0635\u0646\u0648\u0639\u06cc \u0645\u0648\u0644\u062f \u0645\u0639\u0645\u0648\u0644\u0627\u064b \u0627\u0632 \u0686\u0646\u062f\u06cc\u0646 \u0645\u0624\u0644\u0641\u0647 \u0628\u0647 \u0647\u0645 \u067e\u06cc\u0648\u0633\u062a\u0647 \u062a\u0634\u06a9\u06cc\u0644 \u0634\u062f\u0647 \u0627\u0633\u062a:<\/p>\n<p>\u0644\u0627\u06cc\u0647 \u0627\u0631\u06a9\u0633\u062a\u0631\u0627\u0633\u06cc\u0648\u0646\u0645\u0627\u0698\u0648\u0644 \u0633\u0627\u062e\u062a \u0632\u0645\u06cc\u0646\u0647\u06af\u0627\u0631\u062f\u0631\u06cc\u0644 \u0648\u0631\u0648\u062f\u06cc\/\u062e\u0631\u0648\u062c\u06cc\u062f\u0631\u0648\u0627\u0632\u0647 \u0645\u062f\u0644\u0633\u06cc\u0633\u062a\u0645 \u0630\u062e\u06cc\u0631\u0647 \u0633\u0627\u0632\u06ccAction Handlers (\u0641\u0642\u0637 \u062e\u0648\u0627\u0646\u062f\u0646\u06cc \u0648 \u0646\u0648\u0634\u062a\u0627\u0631\u06cc)\u0644\u0627\u06cc\u0647 \u067e\u0627\u06cc\u06af\u0627\u0647 \u062f\u0627\u062f\u0647\u067e\u0634\u062a\u0647 \u0645\u0634\u0627\u0647\u062f\u0647 \u067e\u0630\u06cc\u0631\u06cc<\/p>\n<p>\u0628\u06cc\u0627\u06cc\u06cc\u062f \u0628\u0647 \u0647\u0631 \u06cc\u06a9 \u0627\u0632 \u0627\u06cc\u0646 \u0645\u0624\u0644\u0641\u0647 \u0647\u0627 \u0628\u067e\u0631\u062f\u0627\u0632\u06cc\u0645 \u0648 \u067e\u06cc\u0627\u062f\u0647 \u0633\u0627\u0632\u06cc \u0641\u0646\u06cc \u0622\u0646\u0647\u0627 \u0631\u0627 \u0645\u0648\u0631\u062f \u0628\u062d\u062b \u0642\u0631\u0627\u0631 \u062f\u0647\u06cc\u0645.#1. \u0644\u0627\u06cc\u0647 \u0627\u0631\u06a9\u0633\u062a\u0631\u0627\u0633\u06cc\u0648\u0646\u0644\u0627\u06cc\u0647 \u0627\u0631\u06a9\u0633\u062a\u0631\u0627\u0633\u06cc\u0648\u0646 \u0645\u063a\u0632 \u0639\u0645\u0644\u06cc\u0627\u062a \u0627\u0633\u062a. \u0627\u06cc\u0646 \u0645\u0639\u0645\u0648\u0644\u0627\u064b \u0628\u0647 \u0639\u0646\u0648\u0627\u0646 \u06cc\u06a9 \u0633\u06cc\u0633\u062a\u0645 \u062a\u0648\u0632\u06cc\u0639 \u0634\u062f\u0647 \u0628\u0627 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0627\u0632 \u0641\u0646\u0627\u0648\u0631\u06cc \u0647\u0627\u06cc\u06cc \u0645\u0627\u0646\u0646\u062f Apache Airflow \u06cc\u0627 Kubernetes \u067e\u06cc\u0627\u062f\u0647 \u0633\u0627\u0632\u06cc \u0645\u06cc \u0634\u0648\u062f.<\/p>\n<p>from airflow import DAG<br \/>\nfrom airflow.operators.python_operator import PythonOperator<\/p>\n<p>def process_query(query):<br \/>\n    # Implement query processing logic<br \/>\n    pass<\/p>\n<p>def generate_response(context):<br \/>\n    # Implement response generation logic<br \/>\n    pass<\/p>\n<p>with DAG(&#8216;ai_platform_workflow&#8217;, default_args=default_args, schedule_interval=None) as dag:<br \/>\n    process_task = PythonOperator(<br \/>\n        task_id=&#8217;process_query&#8217;,<br \/>\n        python_callable=process_query,<br \/>\n        op_kwargs={&#8216;query&#8217;: &#8216;{{ dag_run.conf[&#8220;query&#8221;] }}&#8217;}<br \/>\n    )<br \/>\n    generate_task = PythonOperator(<br \/>\n        task_id=&#8217;generate_response&#8217;,<br \/>\n        python_callable=generate_response,<br \/>\n        op_kwargs={&#8216;context&#8217;: &#8216;{{ ti.xcom_pull(task_ids=&#8221;process_query&#8221;) }}&#8217;}<br \/>\n    )<\/p>\n<p>    process_task &gt;&gt; generate_task<\/p>\n<p>    \u0648\u0627\u0631\u062f \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0634\u0648\u06cc\u062f<\/p>\n<p>    \u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/p>\n<p>\u0627\u06cc\u0646 DAG \u06cc\u06a9 \u06af\u0631\u062f\u0634 \u06a9\u0627\u0631 \u0633\u0627\u062f\u0647 \u0631\u0627 \u0628\u0631\u0627\u06cc \u067e\u0631\u062f\u0627\u0632\u0634 \u06cc\u06a9 \u067e\u0631\u0633 \u0648 \u062c\u0648 \u0648 \u0627\u06cc\u062c\u0627\u062f \u06cc\u06a9 \u067e\u0627\u0633\u062e \u062a\u0639\u0631\u06cc\u0641 \u0645\u06cc \u06a9\u0646\u062f.<\/p>\n<p>#2. \u0645\u0627\u0698\u0648\u0644 \u0633\u0627\u062e\u062a \u0632\u0645\u06cc\u0646\u0647\u0645\u0627\u0698\u0648\u0644 \u0633\u0627\u062e\u062a \u0632\u0645\u06cc\u0646\u0647 \u0627\u063a\u0644\u0628 \u0627\u0632 \u062a\u06a9\u0646\u06cc\u06a9 \u0647\u0627\u06cc\u06cc \u0645\u0627\u0646\u0646\u062f RAG (Retrieval-Augmented Generation) \u0648 \u0628\u0627\u0632\u0646\u0648\u06cc\u0633\u06cc \u067e\u0631\u0633 \u0648 \u062c\u0648 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0645\u06cc \u06a9\u0646\u062f. \u062f\u0631 \u0627\u06cc\u0646\u062c\u0627 \u06cc\u06a9 \u067e\u06cc\u0627\u062f\u0647 \u0633\u0627\u0632\u06cc \u0633\u0627\u062f\u0647 \u0628\u0627 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0627\u0632 \u06a9\u062a\u0627\u0628\u062e\u0627\u0646\u0647 langchain \u0622\u0648\u0631\u062f\u0647 \u0634\u062f\u0647 \u0627\u0633\u062a:<\/p>\n<p>from langchain import PromptTemplate, LLMChain<br \/>\nfrom langchain.llms import OpenAI<br \/>\nfrom langchain.retrievers import ElasticSearchBM25Retriever<\/p>\n<p># Initialize retriever<br \/>\nretriever = ElasticSearchBM25Retriever(es_url=&#8221;http:\/\/localhost:9200&#8243;, index_name=&#8221;documents&#8221;)<\/p>\n<p># Define prompt template<br \/>\ntemplate = &#8220;&#8221;&#8221;<br \/>\nContext: {context}<br \/>\nQuery: {query}<br \/>\nGenerate a response based on the above context and query.<br \/>\n&#8220;&#8221;&#8221;<br \/>\nprompt = PromptTemplate(template=template, input_variables=[&#8220;context&#8221;, &#8220;query&#8221;])<\/p>\n<p># Initialize LLM<br \/>\nllm = OpenAI()<br \/>\nllm_chain = LLMChain(prompt=prompt, llm=llm)<\/p>\n<p>def enhance_context(query):<br \/>\n    relevant_docs = retriever.get_relevant_documents(query)<br \/>\n    context = &#8220;\\n&#8221;.join([doc.page_content for doc in relevant_docs])<br \/>\n    return llm_chain.run(context=context, query=query)<\/p>\n<p>    \u0648\u0627\u0631\u062f \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0634\u0648\u06cc\u062f<\/p>\n<p>    \u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/p>\n<p>\u0627\u06cc\u0646 \u0642\u0637\u0639\u0647 \u06a9\u062f \u0646\u062d\u0648\u0647 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0627\u0632 RAG \u0631\u0627 \u0628\u0631\u0627\u06cc \u0628\u0647\u0628\u0648\u062f \u0632\u0645\u06cc\u0646\u0647 \u06cc\u06a9 \u067e\u0631\u0633 \u0648 \u062c\u0648 \u0642\u0628\u0644 \u0627\u0632 \u0627\u0631\u0633\u0627\u0644 \u0622\u0646 \u0628\u0647 \u0645\u062f\u0644 \u0632\u0628\u0627\u0646 \u0646\u0634\u0627\u0646 \u0645\u06cc \u062f\u0647\u062f.<\/p>\n<p>#3. \u06af\u0627\u0631\u062f\u0631\u06cc\u0644 \u0648\u0631\u0648\u062f\u06cc\/\u062e\u0631\u0648\u062c\u06cc\u0627\u062c\u0631\u0627\u06cc \u0646\u0631\u062f\u0647 \u0645\u062d\u0627\u0641\u0638 \u0634\u0627\u0645\u0644 \u0627\u06cc\u062c\u0627\u062f \u0641\u06cc\u0644\u062a\u0631\u0647\u0627\u06cc\u06cc \u0628\u0631\u0627\u06cc \u0648\u0631\u0648\u062f\u06cc \u0648 \u062e\u0631\u0648\u062c\u06cc \u0627\u0633\u062a. \u062f\u0631 \u0627\u06cc\u0646\u062c\u0627 \u06cc\u06a9 \u0645\u062b\u0627\u0644 \u0627\u0633\u0627\u0633\u06cc \u0627\u0633\u062a:<\/p>\n<p>import re<\/p>\n<p>def input_filter(query):<br \/>\n    # Remove potential SQL injection attempts<br \/>\n    query = re.sub(r&#8217;\\b(UNION|SELECT|FROM|WHERE)\\b&#8217;, &#8221;, query, flags=re.IGNORECASE)<br \/>\n    # Remove any non-alphanumeric characters except spaces<br \/>\n    query = re.sub(r'[^\\w\\s]&#8217;, &#8221;, query)<br \/>\n    return query<\/p>\n<p>def output_filter(response):<br \/>\n    # Remove any potential harmful content<br \/>\n    harmful_words = [&#8216;exploit&#8217;, &#8216;hack&#8217;, &#8216;steal&#8217;]\n    for word in harmful_words:<br \/>\n        response = re.sub(r&#8217;\\b&#8217; + word + r&#8217;\\b&#8217;, &#8216;[REDACTED]&#8217;, response, flags=re.IGNORECASE)<br \/>\n    return response<\/p>\n<p>    \u0648\u0627\u0631\u062f \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0634\u0648\u06cc\u062f<\/p>\n<p>    \u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/p>\n<p>\u0627\u06cc\u0646 \u062a\u0648\u0627\u0628\u0639 \u0641\u06cc\u0644\u062a\u0631 \u0627\u0648\u0644\u06cc\u0647 \u0631\u0627 \u0628\u0631\u0627\u06cc \u067e\u0631\u0633 \u0648 \u062c\u0648\u0647\u0627\u06cc \u0648\u0631\u0648\u062f\u06cc \u0648 \u067e\u0627\u0633\u062e \u0647\u0627\u06cc \u062e\u0631\u0648\u062c\u06cc \u0641\u0631\u0627\u0647\u0645 \u0645\u06cc \u06a9\u0646\u0646\u062f.<\/p>\n<p>#4. \u062f\u0631\u0648\u0627\u0632\u0647 \u0645\u062f\u0644\u062f\u0631\u0648\u0627\u0632\u0647 \u0645\u062f\u0644 \u062f\u0633\u062a\u0631\u0633\u06cc \u0628\u0647 \u0645\u062f\u0644 \u0647\u0627\u06cc \u0645\u062e\u062a\u0644\u0641 \u0647\u0648\u0634 \u0645\u0635\u0646\u0648\u0639\u06cc \u0631\u0627 \u0645\u062f\u06cc\u0631\u06cc\u062a \u0645\u06cc \u06a9\u0646\u062f. \u062f\u0631 \u0627\u06cc\u0646\u062c\u0627 \u06cc\u06a9 \u067e\u06cc\u0627\u062f\u0647 \u0633\u0627\u0632\u06cc \u0633\u0627\u062f\u0647 \u0648\u062c\u0648\u062f \u062f\u0627\u0631\u062f:<\/p>\n<p>class ModelGateway:<br \/>\n    def __init__(self):<br \/>\n        self.models = {}<br \/>\n        self.token_usage = {}<\/p>\n<p>    def register_model(self, model_name, model_instance):<br \/>\n        self.models[model_name] = model_instance<br \/>\n        self.token_usage[model_name] = 0<\/p>\n<p>    def get_model(self, model_name):<br \/>\n        return self.models.get(model_name)<\/p>\n<p>    def generate(self, model_name, prompt):<br \/>\n        model = self.get_model(model_name)<br \/>\n        if not model:<br \/>\n            raise ValueError(f&#8221;Model {model_name} not found&#8221;)<br \/>\n        response = model.generate(prompt)<br \/>\n        self.token_usage[model_name] += len(prompt.split())<br \/>\n        return response<\/p>\n<p>gateway = ModelGateway()<br \/>\ngateway.register_model(&#8220;gpt-3&#8221;, OpenAIModel())<br \/>\ngateway.register_model(&#8220;t5&#8243;, T5Model())<\/p>\n<p>    \u0648\u0627\u0631\u062f \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0634\u0648\u06cc\u062f<\/p>\n<p>    \u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/p>\n<p>\u0627\u06cc\u0646 \u062f\u0631\u0648\u0627\u0632\u0647 \u0627\u0645\u06a9\u0627\u0646 \u062b\u0628\u062a \u0686\u0646\u062f\u06cc\u0646 \u0645\u062f\u0644 \u0631\u0627 \u0641\u0631\u0627\u0647\u0645 \u0645\u06cc \u06a9\u0646\u062f \u0648 \u0645\u06cc\u0632\u0627\u0646 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0627\u0632 \u0631\u0645\u0632 \u0631\u0627 \u067e\u06cc\u06af\u06cc\u0631\u06cc \u0645\u06cc \u06a9\u0646\u062f.<\/p>\n<p>#5. \u0633\u06cc\u0633\u062a\u0645 \u0630\u062e\u06cc\u0631\u0647 \u0633\u0627\u0632\u06cc\u067e\u06cc\u0627\u062f\u0647 \u0633\u0627\u0632\u06cc \u06cc\u06a9 \u0633\u06cc\u0633\u062a\u0645 \u06a9\u0634 \u0645\u06cc \u062a\u0648\u0627\u0646\u062f \u0639\u0645\u0644\u06a9\u0631\u062f \u0631\u0627 \u0628\u0647 \u0645\u06cc\u0632\u0627\u0646 \u0642\u0627\u0628\u0644 \u062a\u0648\u062c\u0647\u06cc \u0628\u0647\u0628\u0648\u062f \u0628\u062e\u0634\u062f. \u062f\u0631 \u0627\u06cc\u0646\u062c\u0627 \u06cc\u06a9 \u062d\u0627\u0641\u0638\u0647 \u067e\u0646\u0647\u0627\u0646 \u0645\u0639\u0646\u0627\u06cc\u06cc \u0627\u0648\u0644\u06cc\u0647 \u0648\u062c\u0648\u062f \u062f\u0627\u0631\u062f:<\/p>\n<p>import faiss<br \/>\nimport numpy as np<\/p>\n<p>class SemanticCache:<br \/>\n    def __init__(self, dimension):<br \/>\n        self.index = faiss.IndexFlatL2(dimension)<br \/>\n        self.responses = []\n<p>    def add(self, query_vector, response):<br \/>\n        self.index.add(np.array([query_vector]))<br \/>\n        self.responses.append(response)<\/p>\n<p>    def search(self, query_vector, threshold):<br \/>\n        D, I = self.index.search(np.array([query_vector]), 1)<br \/>\n        if D[0][0] <\/p>\n<p>    \u0648\u0627\u0631\u062f \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0634\u0648\u06cc\u062f<\/p>\n<p>    \u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/p>\n<p>\u0627\u06cc\u0646 \u062d\u0627\u0641\u0638\u0647 \u067e\u0646\u0647\u0627\u0646 \u0627\u0632 FAISS \u0628\u0631\u0627\u06cc \u062c\u0633\u062a\u062c\u0648\u06cc \u0634\u0628\u0627\u0647\u062a \u06a9\u0627\u0631\u0622\u0645\u062f \u062f\u0631 \u062c\u0627\u0633\u0627\u0632\u06cc\u200c\u0647\u0627\u06cc \u067e\u0631\u0633 \u0648 \u062c\u0648 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0645\u06cc\u200c\u06a9\u0646\u062f.<\/p>\n<p>#6. \u0627\u06a9\u0634\u0646 \u0647\u0646\u062f\u0644\u0631\u0647\u0627Action handler \u0645\u0646\u0637\u0642 \u06a9\u0633\u0628 \u0648 \u06a9\u0627\u0631 \u0631\u0627 \u0628\u0631\u0627\u06cc \u0639\u0645\u0644\u06cc\u0627\u062a \u0647\u0627\u06cc \u0645\u062e\u062a\u0644\u0641 \u067e\u06cc\u0627\u062f\u0647 \u0633\u0627\u0632\u06cc \u0645\u06cc \u06a9\u0646\u062f:<\/p>\n<p>&#8220;` Class ReadOnlyActions:@staticmethoddef vector_search (\u067e\u0631\u0633 \u0648 \u062c\u0648\u060c \u0641\u0647\u0631\u0633\u062a):# \u0645\u0646\u0637\u0642 \u062c\u0633\u062a\u062c\u0648\u06cc \u0628\u0631\u062f\u0627\u0631\u06cc \u0631\u0627 \u067e\u06cc\u0627\u062f\u0647 \u0633\u0627\u0632\u06cc \u06a9\u0646\u06cc\u062f\u0639\u0628\u0648\u0631 \u06a9\u0646\u062f<\/p>\n<p>@staticmethod<br \/>\ndef sql_query(query, database):<br \/>\n    # Implement SQL query logic<br \/>\n    pass<\/p>\n<p>    \u0648\u0627\u0631\u062f \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0634\u0648\u06cc\u062f<\/p>\n<p>    \u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/p>\n<p>\u06a9\u0644\u0627\u0633 WriteActions:@staticmethoddef update_database (\u062f\u0627\u062f\u0647\u060c \u067e\u0627\u06cc\u06af\u0627\u0647 \u062f\u0627\u062f\u0647):# \u0645\u0646\u0637\u0642 \u0628\u0647 \u0631\u0648\u0632 \u0631\u0633\u0627\u0646\u06cc \u067e\u0627\u06cc\u06af\u0627\u0647 \u062f\u0627\u062f\u0647 \u0631\u0627 \u067e\u06cc\u0627\u062f\u0647 \u0633\u0627\u0632\u06cc \u06a9\u0646\u06cc\u062f\u0639\u0628\u0648\u0631 \u06a9\u0646\u062f<\/p>\n<p>@staticmethod<br \/>\ndef send_email(recipient, content):<br \/>\n    # Implement email sending logic<br \/>\n    pass<\/p>\n<p>    \u0648\u0627\u0631\u062f \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0634\u0648\u06cc\u062f<\/p>\n<p>    \u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/p>\n<p>These classes provide a framework for implementing various actions that the AI platform might need to perform.<\/p>\n<p>**#7. Database Layer**<br \/>\nThe database layer typically involves multiple types of databases:<\/p>\n<p>    \u0648\u0627\u0631\u062f \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0634\u0648\u06cc\u062f<\/p>\n<p>    \u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/p>\n<p>\u0627\u0632 pymongo import MongoClient\u0627\u0632 \u0648\u0627\u0631\u062f\u0627\u062a elasticsearch Elasticsearch<\/p>\n<p>mongo_client = MongoClient(&#39;mongodb:\/\/localhost:27017\/&#39;)doc_store = mongo_client[&#8216;ai_platform&#8217;][&#8216;documents&#8217;]\n<p>es_client = Elasticsearch([{&#8216;host&#8217;: &#8216;localhost&#8217;, &#8216;port&#8217;: 9200}])vector_index = &#39;\u062c\u0627\u0633\u0627\u0632\u06cc \u0647\u0627&#39;<\/p>\n<p>\u0648\u0627\u0631\u062f\u0627\u062a sqlite3conn = sqlite3.connect(&#39;platform.db&#39;)<\/p>\n<p>This setup includes MongoDB for document storage, Elasticsearch for vector search, and SQLite for relational data.<\/p>\n<p>**#8. Observability Stack**<br \/>\nImplementing proper observability is crucial for maintaining and improving the platform:<\/p>\n<p>&#8220;`import logging<br \/>\nfrom prometheus_client import Counter, Histogram<\/p>\n<p># Logging<br \/>\nlogging.basicConfig(level=logging.INFO)<br \/>\nlogger = logging.getLogger(__name__)<\/p>\n<p># Metrics<br \/>\nrequest_counter = Counter(&#8216;ai_platform_requests_total&#8217;, &#8216;Total number of requests&#8217;)<br \/>\nlatency_histogram = Histogram(&#8216;ai_platform_request_latency_seconds&#8217;, &#8216;Request latency in seconds&#8217;)<\/p>\n<p># Example usage<br \/>\n@latency_histogram.time()<br \/>\ndef process_request(request):<br \/>\n    request_counter.inc()<br \/>\n    logger.info(f&#8221;Processing request: {request}&#8221;)<br \/>\n    # Process the request<br \/>\n    pass<\/p>\n<p>    \u0648\u0627\u0631\u062f \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0634\u0648\u06cc\u062f<\/p>\n<p>    \u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/p>\n<p>\u0627\u06cc\u0646 \u062a\u0646\u0638\u06cc\u0645 \u0634\u0627\u0645\u0644 \u062b\u0628\u062a \u0627\u0648\u0644\u06cc\u0647 \u0648 \u0645\u0639\u06cc\u0627\u0631\u0647\u0627\u06cc Prometheus \u0628\u0631\u0627\u06cc \u0646\u0638\u0627\u0631\u062a \u0628\u0631 \u062a\u0639\u062f\u0627\u062f \u062f\u0631\u062e\u0648\u0627\u0633\u062a \u0647\u0627 \u0648 \u062a\u0623\u062e\u06cc\u0631\u0647\u0627 \u0627\u0633\u062a.<\/p>\n<p>#\u0646\u062a\u06cc\u062c\u0647 \u06af\u06cc\u0631\u06cc\u0633\u0627\u062e\u062a\u0646 \u06cc\u06a9 \u067e\u0644\u062a\u0641\u0631\u0645 \u0647\u0648\u0634 \u0645\u0635\u0646\u0648\u0639\u06cc \u0645\u0648\u0644\u062f \u06cc\u06a9 \u06a9\u0627\u0631 \u067e\u06cc\u0686\u06cc\u062f\u0647 \u0627\u0633\u062a \u06a9\u0647 \u0646\u06cc\u0627\u0632\u0645\u0646\u062f \u0627\u062f\u063a\u0627\u0645 \u062f\u0642\u06cc\u0642 \u0686\u0646\u062f\u06cc\u0646 \u0645\u0624\u0644\u0641\u0647 \u0627\u0633\u062a. \u0647\u0631 \u0628\u062e\u0634 \u0627\u0632 \u0633\u06cc\u0633\u062a\u0645 \u0646\u0642\u0634 \u0645\u0647\u0645\u06cc \u062f\u0631 \u0627\u0631\u0627\u0626\u0647 \u0645\u062d\u062a\u0648\u0627\u06cc \u062f\u0642\u06cc\u0642\u060c \u06a9\u0627\u0631\u0622\u0645\u062f \u0648 \u0627\u06cc\u0645\u0646 \u062a\u0648\u0644\u06cc\u062f \u0634\u062f\u0647 \u062a\u0648\u0633\u0637 \u0647\u0648\u0634 \u0645\u0635\u0646\u0648\u0639\u06cc \u0627\u06cc\u0641\u0627 \u0645\u06cc \u06a9\u0646\u062f. \u0647\u0645\u0627\u0646\u0637\u0648\u0631 \u06a9\u0647 \u067e\u0644\u062a\u0641\u0631\u0645 \u0647\u0648\u0634 \u0645\u0635\u0646\u0648\u0639\u06cc \u062e\u0648\u062f \u0631\u0627 \u062a\u0648\u0633\u0639\u0647 \u0645\u06cc \u062f\u0647\u06cc\u062f\u060c \u0628\u0647 \u06cc\u0627\u062f \u062f\u0627\u0634\u062a\u0647 \u0628\u0627\u0634\u06cc\u062f \u06a9\u0647 \u0627\u06cc\u0646 \u0645\u0639\u0645\u0627\u0631\u06cc \u0641\u0642\u0637 \u06cc\u06a9 \u0646\u0642\u0637\u0647 \u0634\u0631\u0648\u0639 \u0627\u0633\u062a. \u0634\u0645\u0627 \u0628\u0627\u06cc\u062f \u0622\u0646 \u0631\u0627 \u0628\u0631 \u0627\u0633\u0627\u0633 \u0646\u06cc\u0627\u0632\u0647\u0627\u06cc \u062e\u0627\u0635 \u0648 \u0645\u0648\u0627\u0631\u062f \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u062e\u0648\u062f \u062a\u0637\u0628\u06cc\u0642 \u062f\u0627\u062f\u0647 \u0648 \u06af\u0633\u062a\u0631\u0634 \u062f\u0647\u06cc\u062f.<\/p>\n<p>\u062d\u0648\u0632\u0647 \u0647\u0648\u0634 \u0645\u0635\u0646\u0648\u0639\u06cc \u0628\u0647 \u0633\u0631\u0639\u062a \u062f\u0631 \u062d\u0627\u0644 \u067e\u06cc\u0634\u0631\u0641\u062a \u0627\u0633\u062a \u0648 \u0628\u0647\u200c\u0631\u0648\u0632 \u0645\u0627\u0646\u062f\u0646 \u0628\u0627 \u0622\u062e\u0631\u06cc\u0646 \u067e\u06cc\u0634\u0631\u0641\u062a\u200c\u0647\u0627 \u0628\u0633\u06cc\u0627\u0631 \u0645\u0647\u0645 \u0627\u0633\u062a. \u0628\u0647 \u0622\u0632\u0645\u0627\u06cc\u0634\u060c \u06cc\u0627\u062f\u06af\u06cc\u0631\u06cc\u060c \u0648 \u0641\u0634\u0627\u0631 \u062f\u0627\u062f\u0646 \u0628\u0647 \u0645\u0631\u0632\u0647\u0627\u06cc \u0645\u0645\u06a9\u0646 \u0628\u0627 \u0647\u0648\u0634 \u0645\u0635\u0646\u0648\u0639\u06cc \u0645\u0648\u0644\u062f \u0627\u062f\u0627\u0645\u0647 \u062f\u0647\u06cc\u062f!<\/p>\n<div data-article-id=\"1955108\" id=\"article-body\">\n<p>\u0628\u0647 \u0639\u0646\u0648\u0627\u0646 \u06cc\u06a9 \u062a\u0648\u0633\u0639\u0647 \u062f\u0647\u0646\u062f\u0647 \u062f\u0631 \u0641\u0636\u0627\u06cc \u0647\u0648\u0634 \u0645\u0635\u0646\u0648\u0639\u06cc\u060c \u062f\u0631\u06a9 \u0645\u0639\u0645\u0627\u0631\u06cc \u067e\u0644\u062a\u0641\u0631\u0645 \u0647\u0627\u06cc \u0647\u0648\u0634 \u0645\u0635\u0646\u0648\u0639\u06cc \u0645\u0648\u0644\u062f \u0628\u0633\u06cc\u0627\u0631 \u0645\u0647\u0645 \u0627\u0633\u062a. \u0627\u06cc\u0646 \u0633\u06cc\u0633\u062a\u0645 \u0647\u0627 \u062f\u0631 \u062e\u0637 \u0645\u0642\u062f\u0645 \u0628\u0631\u0646\u0627\u0645\u0647 \u0647\u0627\u06cc \u0645\u062f\u0631\u0646 \u0647\u0648\u0634 \u0645\u0635\u0646\u0648\u0639\u06cc \u0642\u0631\u0627\u0631 \u062f\u0627\u0631\u0646\u062f \u0648 \u0642\u0627\u062f\u0631 \u0628\u0647 \u062a\u0648\u0644\u06cc\u062f \u0645\u062a\u0646\u060c \u062a\u0635\u0627\u0648\u06cc\u0631 \u0648 \u063a\u06cc\u0631\u0647 \u0634\u0628\u06cc\u0647 \u0627\u0646\u0633\u0627\u0646 \u0647\u0633\u062a\u0646\u062f. \u062f\u0631 \u0627\u06cc\u0646 \u0645\u0642\u0627\u0644\u0647\u060c \u062c\u0646\u0628\u0647 \u0647\u0627\u06cc \u0641\u0646\u06cc \u0633\u0627\u062e\u062a \u0686\u0646\u06cc\u0646 \u067e\u0644\u062a\u0641\u0631\u0645\u06cc \u0631\u0627 \u0628\u0627 \u062a\u0645\u0631\u06a9\u0632 \u0628\u0631 \u0627\u062c\u0632\u0627\u06cc \u06a9\u0644\u06cc\u062f\u06cc \u0648 \u0627\u062c\u0631\u0627\u06cc \u0622\u0646\u0647\u0627 \u0628\u0631\u0631\u0633\u06cc \u062e\u0648\u0627\u0647\u06cc\u0645 \u06a9\u0631\u062f.<\/p>\n<p><strong>\u0645\u0631\u0648\u0631\u06cc \u0628\u0631 #\u0645\u0639\u0645\u0627\u0631\u06cc<\/strong><br \/>\u06cc\u06a9 \u067e\u0644\u062a\u0641\u0631\u0645 \u0647\u0648\u0634 \u0645\u0635\u0646\u0648\u0639\u06cc \u0645\u0648\u0644\u062f \u0645\u0639\u0645\u0648\u0644\u0627\u064b \u0627\u0632 \u0686\u0646\u062f\u06cc\u0646 \u0645\u0624\u0644\u0641\u0647 \u0628\u0647 \u0647\u0645 \u067e\u06cc\u0648\u0633\u062a\u0647 \u062a\u0634\u06a9\u06cc\u0644 \u0634\u062f\u0647 \u0627\u0633\u062a:<\/p>\n<p>\u0644\u0627\u06cc\u0647 \u0627\u0631\u06a9\u0633\u062a\u0631\u0627\u0633\u06cc\u0648\u0646<br \/>\u0645\u0627\u0698\u0648\u0644 \u0633\u0627\u062e\u062a \u0632\u0645\u06cc\u0646\u0647<br \/>\u06af\u0627\u0631\u062f\u0631\u06cc\u0644 \u0648\u0631\u0648\u062f\u06cc\/\u062e\u0631\u0648\u062c\u06cc<br \/>\u062f\u0631\u0648\u0627\u0632\u0647 \u0645\u062f\u0644<br \/>\u0633\u06cc\u0633\u062a\u0645 \u0630\u062e\u06cc\u0631\u0647 \u0633\u0627\u0632\u06cc<br \/>Action Handlers (\u0641\u0642\u0637 \u062e\u0648\u0627\u0646\u062f\u0646\u06cc \u0648 \u0646\u0648\u0634\u062a\u0627\u0631\u06cc)<br \/>\u0644\u0627\u06cc\u0647 \u067e\u0627\u06cc\u06af\u0627\u0647 \u062f\u0627\u062f\u0647<br \/>\u067e\u0634\u062a\u0647 \u0645\u0634\u0627\u0647\u062f\u0647 \u067e\u0630\u06cc\u0631\u06cc<\/p>\n<p>\u0628\u06cc\u0627\u06cc\u06cc\u062f \u0628\u0647 \u0647\u0631 \u06cc\u06a9 \u0627\u0632 \u0627\u06cc\u0646 \u0645\u0624\u0644\u0641\u0647 \u0647\u0627 \u0628\u067e\u0631\u062f\u0627\u0632\u06cc\u0645 \u0648 \u067e\u06cc\u0627\u062f\u0647 \u0633\u0627\u0632\u06cc \u0641\u0646\u06cc \u0622\u0646\u0647\u0627 \u0631\u0627 \u0645\u0648\u0631\u062f \u0628\u062d\u062b \u0642\u0631\u0627\u0631 \u062f\u0647\u06cc\u0645.<br \/><strong>#1. \u0644\u0627\u06cc\u0647 \u0627\u0631\u06a9\u0633\u062a\u0631\u0627\u0633\u06cc\u0648\u0646<\/strong><br \/>\u0644\u0627\u06cc\u0647 \u0627\u0631\u06a9\u0633\u062a\u0631\u0627\u0633\u06cc\u0648\u0646 \u0645\u063a\u0632 \u0639\u0645\u0644\u06cc\u0627\u062a \u0627\u0633\u062a. \u0627\u06cc\u0646 \u0645\u0639\u0645\u0648\u0644\u0627\u064b \u0628\u0647 \u0639\u0646\u0648\u0627\u0646 \u06cc\u06a9 \u0633\u06cc\u0633\u062a\u0645 \u062a\u0648\u0632\u06cc\u0639 \u0634\u062f\u0647 \u0628\u0627 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0627\u0632 \u0641\u0646\u0627\u0648\u0631\u06cc \u0647\u0627\u06cc\u06cc \u0645\u0627\u0646\u0646\u062f Apache Airflow \u06cc\u0627 Kubernetes \u067e\u06cc\u0627\u062f\u0647 \u0633\u0627\u0632\u06cc \u0645\u06cc \u0634\u0648\u062f.<\/p>\n<div class=\"highlight js-code-highlight\">\n<pre class=\"highlight plaintext\"><code>from airflow import DAG\nfrom airflow.operators.python_operator import PythonOperator\n\ndef process_query(query):\n    # Implement query processing logic\n    pass\n\ndef generate_response(context):\n    # Implement response generation logic\n    pass\n\nwith DAG('ai_platform_workflow', default_args=default_args, schedule_interval=None) as dag:\n    process_task = PythonOperator(\n        task_id='process_query',\n        python_callable=process_query,\n        op_kwargs={'query': '{{ dag_run.conf[\"query\"] }}'}\n    )\n    generate_task = PythonOperator(\n        task_id='generate_response',\n        python_callable=generate_response,\n        op_kwargs={'context': '{{ ti.xcom_pull(task_ids=\"process_query\") }}'}\n    )\n\n    process_task &gt;&gt; generate_task\n<\/code><\/pre>\n<div class=\"highlight__panel js-actions-panel\">\n<div class=\"highlight__panel-action js-fullscreen-code-action\">\n    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-on\"><title>\u0648\u0627\u0631\u062f \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M16 3h6v6h-2V5h-4V3zM2 3h6v2H4v4H2V3zm18 16v-4h2v6h-6v-2h4zM4 19h4v2H2v-6h2v4z\"\/>\n<\/svg><\/p>\n<p>    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-off\"><title>\u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M18 7h4v2h-6V3h2v4zM8 9H2V7h4V3h2v6zm10 8v4h-2v-6h6v2h-4zM8 15v6H6v-4H2v-2h6z\"\/>\n<\/svg><\/p>\n<\/div>\n<\/div>\n<\/div>\n<p>\u0627\u06cc\u0646 DAG \u06cc\u06a9 \u06af\u0631\u062f\u0634 \u06a9\u0627\u0631 \u0633\u0627\u062f\u0647 \u0631\u0627 \u0628\u0631\u0627\u06cc \u067e\u0631\u062f\u0627\u0632\u0634 \u06cc\u06a9 \u067e\u0631\u0633 \u0648 \u062c\u0648 \u0648 \u0627\u06cc\u062c\u0627\u062f \u06cc\u06a9 \u067e\u0627\u0633\u062e \u062a\u0639\u0631\u06cc\u0641 \u0645\u06cc \u06a9\u0646\u062f.<\/p>\n<p><strong>#2. \u0645\u0627\u0698\u0648\u0644 \u0633\u0627\u062e\u062a \u0632\u0645\u06cc\u0646\u0647<\/strong><br \/>\u0645\u0627\u0698\u0648\u0644 \u0633\u0627\u062e\u062a \u0632\u0645\u06cc\u0646\u0647 \u0627\u063a\u0644\u0628 \u0627\u0632 \u062a\u06a9\u0646\u06cc\u06a9 \u0647\u0627\u06cc\u06cc \u0645\u0627\u0646\u0646\u062f RAG (Retrieval-Augmented Generation) \u0648 \u0628\u0627\u0632\u0646\u0648\u06cc\u0633\u06cc \u067e\u0631\u0633 \u0648 \u062c\u0648 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0645\u06cc \u06a9\u0646\u062f. \u062f\u0631 \u0627\u06cc\u0646\u062c\u0627 \u06cc\u06a9 \u067e\u06cc\u0627\u062f\u0647 \u0633\u0627\u0632\u06cc \u0633\u0627\u062f\u0647 \u0628\u0627 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0627\u0632 \u06a9\u062a\u0627\u0628\u062e\u0627\u0646\u0647 langchain \u0622\u0648\u0631\u062f\u0647 \u0634\u062f\u0647 \u0627\u0633\u062a:<\/p>\n<div class=\"highlight js-code-highlight\">\n<pre class=\"highlight plaintext\"><code>from langchain import PromptTemplate, LLMChain\nfrom langchain.llms import OpenAI\nfrom langchain.retrievers import ElasticSearchBM25Retriever\n\n# Initialize retriever\nretriever = ElasticSearchBM25Retriever(es_url=\"http:\/\/localhost:9200\", index_name=\"documents\")\n\n# Define prompt template\ntemplate = \"\"\"\nContext: {context}\nQuery: {query}\nGenerate a response based on the above context and query.\n\"\"\"\nprompt = PromptTemplate(template=template, input_variables=[\"context\", \"query\"])\n\n# Initialize LLM\nllm = OpenAI()\nllm_chain = LLMChain(prompt=prompt, llm=llm)\n\ndef enhance_context(query):\n    relevant_docs = retriever.get_relevant_documents(query)\n    context = \"\\n\".join([doc.page_content for doc in relevant_docs])\n    return llm_chain.run(context=context, query=query)\n<\/code><\/pre>\n<div class=\"highlight__panel js-actions-panel\">\n<div class=\"highlight__panel-action js-fullscreen-code-action\">\n    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-on\"><title>\u0648\u0627\u0631\u062f \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M16 3h6v6h-2V5h-4V3zM2 3h6v2H4v4H2V3zm18 16v-4h2v6h-6v-2h4zM4 19h4v2H2v-6h2v4z\"\/>\n<\/svg><\/p>\n<p>    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-off\"><title>\u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M18 7h4v2h-6V3h2v4zM8 9H2V7h4V3h2v6zm10 8v4h-2v-6h6v2h-4zM8 15v6H6v-4H2v-2h6z\"\/>\n<\/svg><\/p>\n<\/div>\n<\/div>\n<\/div>\n<p>\u0627\u06cc\u0646 \u0642\u0637\u0639\u0647 \u06a9\u062f \u0646\u062d\u0648\u0647 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0627\u0632 RAG \u0631\u0627 \u0628\u0631\u0627\u06cc \u0628\u0647\u0628\u0648\u062f \u0632\u0645\u06cc\u0646\u0647 \u06cc\u06a9 \u067e\u0631\u0633 \u0648 \u062c\u0648 \u0642\u0628\u0644 \u0627\u0632 \u0627\u0631\u0633\u0627\u0644 \u0622\u0646 \u0628\u0647 \u0645\u062f\u0644 \u0632\u0628\u0627\u0646 \u0646\u0634\u0627\u0646 \u0645\u06cc \u062f\u0647\u062f.<\/p>\n<p><strong>#3. \u06af\u0627\u0631\u062f\u0631\u06cc\u0644 \u0648\u0631\u0648\u062f\u06cc\/\u062e\u0631\u0648\u062c\u06cc<\/strong><br \/>\u0627\u062c\u0631\u0627\u06cc \u0646\u0631\u062f\u0647 \u0645\u062d\u0627\u0641\u0638 \u0634\u0627\u0645\u0644 \u0627\u06cc\u062c\u0627\u062f \u0641\u06cc\u0644\u062a\u0631\u0647\u0627\u06cc\u06cc \u0628\u0631\u0627\u06cc \u0648\u0631\u0648\u062f\u06cc \u0648 \u062e\u0631\u0648\u062c\u06cc \u0627\u0633\u062a. \u062f\u0631 \u0627\u06cc\u0646\u062c\u0627 \u06cc\u06a9 \u0645\u062b\u0627\u0644 \u0627\u0633\u0627\u0633\u06cc \u0627\u0633\u062a:<\/p>\n<div class=\"highlight js-code-highlight\">\n<pre class=\"highlight plaintext\"><code>import re\n\ndef input_filter(query):\n    # Remove potential SQL injection attempts\n    query = re.sub(r'\\b(UNION|SELECT|FROM|WHERE)\\b', '', query, flags=re.IGNORECASE)\n    # Remove any non-alphanumeric characters except spaces\n    query = re.sub(r'[^\\w\\s]', '', query)\n    return query\n\ndef output_filter(response):\n    # Remove any potential harmful content\n    harmful_words = ['exploit', 'hack', 'steal']\n    for word in harmful_words:\n        response = re.sub(r'\\b' + word + r'\\b', '[REDACTED]', response, flags=re.IGNORECASE)\n    return response\n<\/code><\/pre>\n<div class=\"highlight__panel js-actions-panel\">\n<div class=\"highlight__panel-action js-fullscreen-code-action\">\n    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-on\"><title>\u0648\u0627\u0631\u062f \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M16 3h6v6h-2V5h-4V3zM2 3h6v2H4v4H2V3zm18 16v-4h2v6h-6v-2h4zM4 19h4v2H2v-6h2v4z\"\/>\n<\/svg><\/p>\n<p>    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-off\"><title>\u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M18 7h4v2h-6V3h2v4zM8 9H2V7h4V3h2v6zm10 8v4h-2v-6h6v2h-4zM8 15v6H6v-4H2v-2h6z\"\/>\n<\/svg><\/p>\n<\/div>\n<\/div>\n<\/div>\n<p>\u0627\u06cc\u0646 \u062a\u0648\u0627\u0628\u0639 \u0641\u06cc\u0644\u062a\u0631 \u0627\u0648\u0644\u06cc\u0647 \u0631\u0627 \u0628\u0631\u0627\u06cc \u067e\u0631\u0633 \u0648 \u062c\u0648\u0647\u0627\u06cc \u0648\u0631\u0648\u062f\u06cc \u0648 \u067e\u0627\u0633\u062e \u0647\u0627\u06cc \u062e\u0631\u0648\u062c\u06cc \u0641\u0631\u0627\u0647\u0645 \u0645\u06cc \u06a9\u0646\u0646\u062f.<\/p>\n<p><strong>#4. \u062f\u0631\u0648\u0627\u0632\u0647 \u0645\u062f\u0644<\/strong><br \/>\u062f\u0631\u0648\u0627\u0632\u0647 \u0645\u062f\u0644 \u062f\u0633\u062a\u0631\u0633\u06cc \u0628\u0647 \u0645\u062f\u0644 \u0647\u0627\u06cc \u0645\u062e\u062a\u0644\u0641 \u0647\u0648\u0634 \u0645\u0635\u0646\u0648\u0639\u06cc \u0631\u0627 \u0645\u062f\u06cc\u0631\u06cc\u062a \u0645\u06cc \u06a9\u0646\u062f. \u062f\u0631 \u0627\u06cc\u0646\u062c\u0627 \u06cc\u06a9 \u067e\u06cc\u0627\u062f\u0647 \u0633\u0627\u0632\u06cc \u0633\u0627\u062f\u0647 \u0648\u062c\u0648\u062f \u062f\u0627\u0631\u062f:<\/p>\n<div class=\"highlight js-code-highlight\">\n<pre class=\"highlight plaintext\"><code>class ModelGateway:\n    def __init__(self):\n        self.models = {}\n        self.token_usage = {}\n\n    def register_model(self, model_name, model_instance):\n        self.models[model_name] = model_instance\n        self.token_usage[model_name] = 0\n\n    def get_model(self, model_name):\n        return self.models.get(model_name)\n\n    def generate(self, model_name, prompt):\n        model = self.get_model(model_name)\n        if not model:\n            raise ValueError(f\"Model {model_name} not found\")\n        response = model.generate(prompt)\n        self.token_usage[model_name] += len(prompt.split())\n        return response\n\ngateway = ModelGateway()\ngateway.register_model(\"gpt-3\", OpenAIModel())\ngateway.register_model(\"t5\", T5Model())\n<\/code><\/pre>\n<div class=\"highlight__panel js-actions-panel\">\n<div class=\"highlight__panel-action js-fullscreen-code-action\">\n    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-on\"><title>\u0648\u0627\u0631\u062f \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M16 3h6v6h-2V5h-4V3zM2 3h6v2H4v4H2V3zm18 16v-4h2v6h-6v-2h4zM4 19h4v2H2v-6h2v4z\"\/>\n<\/svg><\/p>\n<p>    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-off\"><title>\u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M18 7h4v2h-6V3h2v4zM8 9H2V7h4V3h2v6zm10 8v4h-2v-6h6v2h-4zM8 15v6H6v-4H2v-2h6z\"\/>\n<\/svg><\/p>\n<\/div>\n<\/div>\n<\/div>\n<p>\u0627\u06cc\u0646 \u062f\u0631\u0648\u0627\u0632\u0647 \u0627\u0645\u06a9\u0627\u0646 \u062b\u0628\u062a \u0686\u0646\u062f\u06cc\u0646 \u0645\u062f\u0644 \u0631\u0627 \u0641\u0631\u0627\u0647\u0645 \u0645\u06cc \u06a9\u0646\u062f \u0648 \u0645\u06cc\u0632\u0627\u0646 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0627\u0632 \u0631\u0645\u0632 \u0631\u0627 \u067e\u06cc\u06af\u06cc\u0631\u06cc \u0645\u06cc \u06a9\u0646\u062f.<\/p>\n<p><strong>#5. \u0633\u06cc\u0633\u062a\u0645 \u0630\u062e\u06cc\u0631\u0647 \u0633\u0627\u0632\u06cc<\/strong><br \/>\u067e\u06cc\u0627\u062f\u0647 \u0633\u0627\u0632\u06cc \u06cc\u06a9 \u0633\u06cc\u0633\u062a\u0645 \u06a9\u0634 \u0645\u06cc \u062a\u0648\u0627\u0646\u062f \u0639\u0645\u0644\u06a9\u0631\u062f \u0631\u0627 \u0628\u0647 \u0645\u06cc\u0632\u0627\u0646 \u0642\u0627\u0628\u0644 \u062a\u0648\u062c\u0647\u06cc \u0628\u0647\u0628\u0648\u062f \u0628\u062e\u0634\u062f. \u062f\u0631 \u0627\u06cc\u0646\u062c\u0627 \u06cc\u06a9 \u062d\u0627\u0641\u0638\u0647 \u067e\u0646\u0647\u0627\u0646 \u0645\u0639\u0646\u0627\u06cc\u06cc \u0627\u0648\u0644\u06cc\u0647 \u0648\u062c\u0648\u062f \u062f\u0627\u0631\u062f:<\/p>\n<div class=\"highlight js-code-highlight\">\n<pre class=\"highlight plaintext\"><code>import faiss\nimport numpy as np\n\nclass SemanticCache:\n    def __init__(self, dimension):\n        self.index = faiss.IndexFlatL2(dimension)\n        self.responses = []\n\n    def add(self, query_vector, response):\n        self.index.add(np.array([query_vector]))\n        self.responses.append(response)\n\n    def search(self, query_vector, threshold):\n        D, I = self.index.search(np.array([query_vector]), 1)\n        if D[0][0] <\/code><\/pre>\n<div class=\"highlight__panel js-actions-panel\">\n<div class=\"highlight__panel-action js-fullscreen-code-action\">\n    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-on\"><title>\u0648\u0627\u0631\u062f \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M16 3h6v6h-2V5h-4V3zM2 3h6v2H4v4H2V3zm18 16v-4h2v6h-6v-2h4zM4 19h4v2H2v-6h2v4z\"\/>\n<\/svg><\/p>\n<p>    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-off\"><title>\u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M18 7h4v2h-6V3h2v4zM8 9H2V7h4V3h2v6zm10 8v4h-2v-6h6v2h-4zM8 15v6H6v-4H2v-2h6z\"\/>\n<\/svg><\/p>\n<\/div>\n<\/div>\n<\/div>\n<p>\u0627\u06cc\u0646 \u062d\u0627\u0641\u0638\u0647 \u067e\u0646\u0647\u0627\u0646 \u0627\u0632 FAISS \u0628\u0631\u0627\u06cc \u062c\u0633\u062a\u062c\u0648\u06cc \u0634\u0628\u0627\u0647\u062a \u06a9\u0627\u0631\u0622\u0645\u062f \u062f\u0631 \u062c\u0627\u0633\u0627\u0632\u06cc\u200c\u0647\u0627\u06cc \u067e\u0631\u0633 \u0648 \u062c\u0648 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0645\u06cc\u200c\u06a9\u0646\u062f.<\/p>\n<p><strong>#6. \u0627\u06a9\u0634\u0646 \u0647\u0646\u062f\u0644\u0631\u0647\u0627<\/strong><br \/>Action handler \u0645\u0646\u0637\u0642 \u06a9\u0633\u0628 \u0648 \u06a9\u0627\u0631 \u0631\u0627 \u0628\u0631\u0627\u06cc \u0639\u0645\u0644\u06cc\u0627\u062a \u0647\u0627\u06cc \u0645\u062e\u062a\u0644\u0641 \u067e\u06cc\u0627\u062f\u0647 \u0633\u0627\u0632\u06cc \u0645\u06cc \u06a9\u0646\u062f:<\/p>\n<p>&#8220;` Class ReadOnlyActions:<br \/>@staticmethod<br \/>def vector_search (\u067e\u0631\u0633 \u0648 \u062c\u0648\u060c \u0641\u0647\u0631\u0633\u062a):<br \/># \u0645\u0646\u0637\u0642 \u062c\u0633\u062a\u062c\u0648\u06cc \u0628\u0631\u062f\u0627\u0631\u06cc \u0631\u0627 \u067e\u06cc\u0627\u062f\u0647 \u0633\u0627\u0632\u06cc \u06a9\u0646\u06cc\u062f<br \/>\u0639\u0628\u0648\u0631 \u06a9\u0646\u062f<\/p>\n<div class=\"highlight js-code-highlight\">\n<pre class=\"highlight plaintext\"><code>@staticmethod\ndef sql_query(query, database):\n    # Implement SQL query logic\n    pass\n<\/code><\/pre>\n<div class=\"highlight__panel js-actions-panel\">\n<div class=\"highlight__panel-action js-fullscreen-code-action\">\n    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-on\"><title>\u0648\u0627\u0631\u062f \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M16 3h6v6h-2V5h-4V3zM2 3h6v2H4v4H2V3zm18 16v-4h2v6h-6v-2h4zM4 19h4v2H2v-6h2v4z\"\/>\n<\/svg><\/p>\n<p>    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-off\"><title>\u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M18 7h4v2h-6V3h2v4zM8 9H2V7h4V3h2v6zm10 8v4h-2v-6h6v2h-4zM8 15v6H6v-4H2v-2h6z\"\/>\n<\/svg><\/p>\n<\/div>\n<\/div>\n<\/div>\n<p>\u06a9\u0644\u0627\u0633 WriteActions:<br \/>@staticmethod<br \/>def update_database (\u062f\u0627\u062f\u0647\u060c \u067e\u0627\u06cc\u06af\u0627\u0647 \u062f\u0627\u062f\u0647):<br \/># \u0645\u0646\u0637\u0642 \u0628\u0647 \u0631\u0648\u0632 \u0631\u0633\u0627\u0646\u06cc \u067e\u0627\u06cc\u06af\u0627\u0647 \u062f\u0627\u062f\u0647 \u0631\u0627 \u067e\u06cc\u0627\u062f\u0647 \u0633\u0627\u0632\u06cc \u06a9\u0646\u06cc\u062f<br \/>\u0639\u0628\u0648\u0631 \u06a9\u0646\u062f<\/p>\n<div class=\"highlight js-code-highlight\">\n<pre class=\"highlight plaintext\"><code>@staticmethod\ndef send_email(recipient, content):\n    # Implement email sending logic\n    pass\n<\/code><\/pre>\n<div class=\"highlight__panel js-actions-panel\">\n<div class=\"highlight__panel-action js-fullscreen-code-action\">\n    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-on\"><title>\u0648\u0627\u0631\u062f \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M16 3h6v6h-2V5h-4V3zM2 3h6v2H4v4H2V3zm18 16v-4h2v6h-6v-2h4zM4 19h4v2H2v-6h2v4z\"\/>\n<\/svg><\/p>\n<p>    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-off\"><title>\u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M18 7h4v2h-6V3h2v4zM8 9H2V7h4V3h2v6zm10 8v4h-2v-6h6v2h-4zM8 15v6H6v-4H2v-2h6z\"\/>\n<\/svg><\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"highlight js-code-highlight\">\n<pre class=\"highlight plaintext\"><code>\n\nThese classes provide a framework for implementing various actions that the AI platform might need to perform.\n\n**#7. Database Layer**\nThe database layer typically involves multiple types of databases:\n\n\n<\/code><\/pre>\n<div class=\"highlight__panel js-actions-panel\">\n<div class=\"highlight__panel-action js-fullscreen-code-action\">\n    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-on\"><title>\u0648\u0627\u0631\u062f \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M16 3h6v6h-2V5h-4V3zM2 3h6v2H4v4H2V3zm18 16v-4h2v6h-6v-2h4zM4 19h4v2H2v-6h2v4z\"\/>\n<\/svg><\/p>\n<p>    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-off\"><title>\u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M18 7h4v2h-6V3h2v4zM8 9H2V7h4V3h2v6zm10 8v4h-2v-6h6v2h-4zM8 15v6H6v-4H2v-2h6z\"\/>\n<\/svg><\/p>\n<\/div>\n<\/div>\n<\/div>\n<p>\u0627\u0632 pymongo import MongoClient<br \/>\u0627\u0632 \u0648\u0627\u0631\u062f\u0627\u062a elasticsearch Elasticsearch<\/p>\n<p>mongo_client = MongoClient(&#39;mongodb:\/\/localhost:27017\/&#39;)<br \/>doc_store = mongo_client[&#8216;ai_platform&#8217;][&#8216;documents&#8217;]\n<p>es_client = Elasticsearch([{&#8216;host&#8217;: &#8216;localhost&#8217;, &#8216;port&#8217;: 9200}])<br \/>vector_index = &#39;\u062c\u0627\u0633\u0627\u0632\u06cc \u0647\u0627&#39;<\/p>\n<p>\u0648\u0627\u0631\u062f\u0627\u062a sqlite3<br \/>conn = sqlite3.connect(&#39;platform.db&#39;)<\/p>\n<div class=\"highlight js-code-highlight\">\n<pre class=\"highlight plaintext\"><code>\n\nThis setup includes MongoDB for document storage, Elasticsearch for vector search, and SQLite for relational data.\n\n**#8. Observability Stack**\nImplementing proper observability is crucial for maintaining and improving the platform:\n\n\n```import logging\nfrom prometheus_client import Counter, Histogram\n\n# Logging\nlogging.basicConfig(level=logging.INFO)\nlogger = logging.getLogger(__name__)\n\n# Metrics\nrequest_counter = Counter('ai_platform_requests_total', 'Total number of requests')\nlatency_histogram = Histogram('ai_platform_request_latency_seconds', 'Request latency in seconds')\n\n# Example usage\n@latency_histogram.time()\ndef process_request(request):\n    request_counter.inc()\n    logger.info(f\"Processing request: {request}\")\n    # Process the request\n    pass\n<\/code><\/pre>\n<div class=\"highlight__panel js-actions-panel\">\n<div class=\"highlight__panel-action js-fullscreen-code-action\">\n    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-on\"><title>\u0648\u0627\u0631\u062f \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M16 3h6v6h-2V5h-4V3zM2 3h6v2H4v4H2V3zm18 16v-4h2v6h-6v-2h4zM4 19h4v2H2v-6h2v4z\"\/>\n<\/svg><\/p>\n<p>    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-off\"><title>\u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M18 7h4v2h-6V3h2v4zM8 9H2V7h4V3h2v6zm10 8v4h-2v-6h6v2h-4zM8 15v6H6v-4H2v-2h6z\"\/>\n<\/svg><\/p>\n<\/div>\n<\/div>\n<\/div>\n<p>\u0627\u06cc\u0646 \u062a\u0646\u0638\u06cc\u0645 \u0634\u0627\u0645\u0644 \u062b\u0628\u062a \u0627\u0648\u0644\u06cc\u0647 \u0648 \u0645\u0639\u06cc\u0627\u0631\u0647\u0627\u06cc Prometheus \u0628\u0631\u0627\u06cc \u0646\u0638\u0627\u0631\u062a \u0628\u0631 \u062a\u0639\u062f\u0627\u062f \u062f\u0631\u062e\u0648\u0627\u0633\u062a \u0647\u0627 \u0648 \u062a\u0623\u062e\u06cc\u0631\u0647\u0627 \u0627\u0633\u062a.<\/p>\n<p><strong>#\u0646\u062a\u06cc\u062c\u0647 \u06af\u06cc\u0631\u06cc<\/strong><br \/>\u0633\u0627\u062e\u062a\u0646 \u06cc\u06a9 \u067e\u0644\u062a\u0641\u0631\u0645 \u0647\u0648\u0634 \u0645\u0635\u0646\u0648\u0639\u06cc \u0645\u0648\u0644\u062f \u06cc\u06a9 \u06a9\u0627\u0631 \u067e\u06cc\u0686\u06cc\u062f\u0647 \u0627\u0633\u062a \u06a9\u0647 \u0646\u06cc\u0627\u0632\u0645\u0646\u062f \u0627\u062f\u063a\u0627\u0645 \u062f\u0642\u06cc\u0642 \u0686\u0646\u062f\u06cc\u0646 \u0645\u0624\u0644\u0641\u0647 \u0627\u0633\u062a. \u0647\u0631 \u0628\u062e\u0634 \u0627\u0632 \u0633\u06cc\u0633\u062a\u0645 \u0646\u0642\u0634 \u0645\u0647\u0645\u06cc \u062f\u0631 \u0627\u0631\u0627\u0626\u0647 \u0645\u062d\u062a\u0648\u0627\u06cc \u062f\u0642\u06cc\u0642\u060c \u06a9\u0627\u0631\u0622\u0645\u062f \u0648 \u0627\u06cc\u0645\u0646 \u062a\u0648\u0644\u06cc\u062f \u0634\u062f\u0647 \u062a\u0648\u0633\u0637 \u0647\u0648\u0634 \u0645\u0635\u0646\u0648\u0639\u06cc \u0627\u06cc\u0641\u0627 \u0645\u06cc \u06a9\u0646\u062f. \u0647\u0645\u0627\u0646\u0637\u0648\u0631 \u06a9\u0647 \u067e\u0644\u062a\u0641\u0631\u0645 \u0647\u0648\u0634 \u0645\u0635\u0646\u0648\u0639\u06cc \u062e\u0648\u062f \u0631\u0627 \u062a\u0648\u0633\u0639\u0647 \u0645\u06cc \u062f\u0647\u06cc\u062f\u060c \u0628\u0647 \u06cc\u0627\u062f \u062f\u0627\u0634\u062a\u0647 \u0628\u0627\u0634\u06cc\u062f \u06a9\u0647 \u0627\u06cc\u0646 \u0645\u0639\u0645\u0627\u0631\u06cc \u0641\u0642\u0637 \u06cc\u06a9 \u0646\u0642\u0637\u0647 \u0634\u0631\u0648\u0639 \u0627\u0633\u062a. \u0634\u0645\u0627 \u0628\u0627\u06cc\u062f \u0622\u0646 \u0631\u0627 \u0628\u0631 \u0627\u0633\u0627\u0633 \u0646\u06cc\u0627\u0632\u0647\u0627\u06cc \u062e\u0627\u0635 \u0648 \u0645\u0648\u0627\u0631\u062f \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u062e\u0648\u062f \u062a\u0637\u0628\u06cc\u0642 \u062f\u0627\u062f\u0647 \u0648 \u06af\u0633\u062a\u0631\u0634 \u062f\u0647\u06cc\u062f.<\/p>\n<p>\u062d\u0648\u0632\u0647 \u0647\u0648\u0634 \u0645\u0635\u0646\u0648\u0639\u06cc \u0628\u0647 \u0633\u0631\u0639\u062a \u062f\u0631 \u062d\u0627\u0644 \u067e\u06cc\u0634\u0631\u0641\u062a \u0627\u0633\u062a \u0648 \u0628\u0647\u200c\u0631\u0648\u0632 \u0645\u0627\u0646\u062f\u0646 \u0628\u0627 \u0622\u062e\u0631\u06cc\u0646 \u067e\u06cc\u0634\u0631\u0641\u062a\u200c\u0647\u0627 \u0628\u0633\u06cc\u0627\u0631 \u0645\u0647\u0645 \u0627\u0633\u062a. \u0628\u0647 \u0622\u0632\u0645\u0627\u06cc\u0634\u060c \u06cc\u0627\u062f\u06af\u06cc\u0631\u06cc\u060c \u0648 \u0641\u0634\u0627\u0631 \u062f\u0627\u062f\u0646 \u0628\u0647 \u0645\u0631\u0632\u0647\u0627\u06cc \u0645\u0645\u06a9\u0646 \u0628\u0627 \u0647\u0648\u0634 \u0645\u0635\u0646\u0648\u0639\u06cc \u0645\u0648\u0644\u062f \u0627\u062f\u0627\u0645\u0647 \u062f\u0647\u06cc\u062f!<\/p>\n<\/p><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Summarize this content to 400 words in Persian Lang \u0628\u0647 \u0639\u0646\u0648\u0627\u0646 \u06cc\u06a9 \u062a\u0648\u0633\u0639\u0647 \u062f\u0647\u0646\u062f\u0647 \u062f\u0631 \u0641\u0636\u0627\u06cc \u0647\u0648\u0634 \u0645\u0635\u0646\u0648\u0639\u06cc\u060c \u062f\u0631\u06a9 \u0645\u0639\u0645\u0627\u0631\u06cc \u067e\u0644\u062a\u0641\u0631\u0645 \u0647\u0627\u06cc \u0647\u0648\u0634 \u0645\u0635\u0646\u0648\u0639\u06cc \u0645\u0648\u0644\u062f \u0628\u0633\u06cc\u0627\u0631 \u0645\u0647\u0645 \u0627\u0633\u062a. \u0627\u06cc\u0646 \u0633\u06cc\u0633\u062a\u0645 \u0647\u0627 \u062f\u0631 \u062e\u0637 \u0645\u0642\u062f\u0645 \u0628\u0631\u0646\u0627\u0645\u0647 \u0647\u0627\u06cc \u0645\u062f\u0631\u0646 \u0647\u0648\u0634 \u0645\u0635\u0646\u0648\u0639\u06cc \u0642\u0631\u0627\u0631 \u062f\u0627\u0631\u0646\u062f \u0648 \u0642\u0627\u062f\u0631 \u0628\u0647 \u062a\u0648\u0644\u06cc\u062f \u0645\u062a\u0646\u060c \u062a\u0635\u0627\u0648\u06cc\u0631 \u0648 \u063a\u06cc\u0631\u0647 \u0634\u0628\u06cc\u0647 \u0627\u0646\u0633\u0627\u0646 \u0647\u0633\u062a\u0646\u062f. \u062f\u0631 \u0627\u06cc\u0646 \u0645\u0642\u0627\u0644\u0647\u060c &hellip;<\/p>\n","protected":false},"author":2,"featured_media":73056,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"fifu_image_url":"","fifu_image_alt":"","footnotes":""},"categories":[339],"tags":[],"class_list":["post-73055","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-dev"],"_links":{"self":[{"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/posts\/73055","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/comments?post=73055"}],"version-history":[{"count":0,"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/posts\/73055\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/media\/73056"}],"wp:attachment":[{"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/media?parent=73055"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/categories?post=73055"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/tags?post=73055"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}