Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Langhchain.pdf

Kardel Ruveyda
July 21, 2024
98

 Langhchain.pdf

Kardel Ruveyda

July 21, 2024
Tweet

Transcript

  1. 2023- YILDIZ TECHNICAL UNIVERSİTY Mathematical Engineering (Licentiate Degree) YILDIZ TECHNICAL

    UNIVERSİTY Computer Engineering/IT (Master's Degree (Non-Thesis)) 2013-2018 2019-2020 YILDIZ TECHNICAL UNIVERSİTY Mathematical Engineering (Master's Degree (Thesis)) 2021-.. DOĞUŞ TEKNOLOJİ Software Support Asistant Specialist Software Asistant Specialist Software Specialist 2018-2021 KARİYER.NET Software Specialist Senior Software Specialist Expert Software Engineer Mavi (2016) Overtech (2017) INTERNSHIPS Junior Frontend Developer 2018 ICONEC WAVE kardelruveydacetin KardelRuveyda @ruveydakardelcetin
  2. What is Langchain? Developed in the last 2 years! LangChain

    is a framework for developing applications powered by large language models (LLMs). It is developing very fast. It recently announced version 0.2.9 (July 17, 2024)
  3. v 1.0 langchain-core: Base abstractions and LangChain Expression Language. langchain-community:

    Third party integrations. Partner packages (e.g. langchain-openai, langchain-anthropic, etc.): Some integrations have been further split into their own lightweight packages that only depend on langchain-core. langchain: Chains, agents, and retrieval strategies that make up an application's cognitive architecture. langgraph: Build robust and stateful multi-actor applications with LLMs by modeling steps as edges and nodes in a graph. langserve: Deploy LangChain chains as REST APIs LangSmith: A developer platform that lets you debug, test, evaluate, and monitor LLM applications and seamlessly integrates with LangChain
  4. Using langchain_openai gpt-4 The code assigns an instance of the

    ChatOpenAI class to a variable named llm. When creating this instance, the model to be used needs to be specified via the model_name parameter. Here, a model called “gpt-4” is chosen. The purpose of this code is to create a text-based chatbot using the GPT- 4 artificial intelligence model provided by OpenAI and create an instance of the ChatOpenAI class for this purpose.
  5. Using langchain_openai gpt-4 .First, a variable named text is assigned

    the text “Who is Albert Einstein?”. This text represents a question to be asked to the AI model. Then, the invoke() method is called to execute the text query in the text variable on the model and the model's response is assigned to a variable called response. Finally, when the response variable is called, the response from the AI model is received and this response is presented to the user or processed.
  6. Compare Models ChatOpenAI vs OpenAI One popular science fiction film

    that is often recommended is "Blade Runner" (1982) directed by Ridley Scott. Other options include "The Matrix" (1999) directed by the Wachowskis, "Inception" (2010) directed by Christopher Nolan, "2001: A Space Odyssey" (1968) directed by Stanley Kubrick, and "Eternal Sunshine of the Spotless Mind" (2004) directed by Michel Gondry. AIMessage(content='I recommend "Blade Runner 2049" directed by Denis Villeneuve. This film is a visually stunning and thought-provoking sequel to the original "Blade Runner" and explores themes of artificial intelligence, identity, and the nature of humanity. It has received critical acclaim for its stunning visuals, compelling story, and exceptional performances by the cast.', response_metadata={'token_usage': {'completion_tokens': 72, 'prompt_tokens': 16, 'total_tokens': 88}, 'model_name': 'gpt-4', 'system_fingerprint': None, 'finish_reason': 'stop', 'logprobs': None}, id='run-265cdb29-f2a5-4676-a879- cadfad449a0c-0', usage_metadata={'input_tokens': 16, 'output_tokens': 72, 'total_tokens': 88}) OPENAI ChatOpenAI
  7. Merge LLM and Prompt and Create Chain AIMessage(content='One highly recommended

    romantic comedy film is "When Harry Met Sally" directed by Rob Reiner. This classic film follows the story of Harry and Sally as they navigate their complicated relationship over the years, exploring themes of friendship, love, and destiny. With witty dialogue, charming performances by Billy Crystal and Meg Ryan, and an iconic scene in Katz\'s Delicatessen, "When Harry Met Sally" is a must-watch for fans of the genre.', response_metadata={'token_usage': {'completion_tokens': 90, 'prompt_tokens': 16, 'total_tokens': 106}, 'model_name': 'gpt-4', 'system_fingerprint': 'fp_b28b39ffa8', 'finish_reason': 'stop', 'logprobs': None})
  8. You can change chain result with Output Parser One popular

    and well-reviewed romantic comedy film is "Crazy, Stupid, Love" starring Steve Carell, Ryan Gosling, and Emma Stone. The movie follows the story of a recently divorced man who seeks advice on dating from a suave bachelor, only to realize that love may be closer than he thinks. It's a funny and heartwarming film that explores the ups and downs of relationships in a humorous and relatable way.
  9. RAG (Retrieval-Augmented Generation) Retrieval Step: LLM is not used. Information

    is retrieved from the data pool. Processing and Preprocessing: The retrieved information is prepared for use by the LLM. Generation Step (Using LLM): The LLM uses the retrieved information to generate a meaningful and coherent response for the user.
  10. RAG (Retrieval-Augmented Generation) “RAG combines two basic operations: first it

    fetches information (finds the right information about your question), then it uses this information to generate an answer. This method allows the model to provide more accurate and knowledge-filled answers because it accesses and utilizes not only its own “memorized” knowledge, but also a large pool of knowledge.”
  11. Retrieval Technique with Langchain Numerical representations with embeddings We will

    set up a vector database to store these representations. (Faiss vs Chroma) Faiss:Facebook AI Similarity Search
  12. Retrieval Technique with Langchain The movie with the highest IMDb

    score is "The Shawshank Redemption" with a rating of 9.3.
  13. Developer’s ML RoadMap Matlab Text Analytics Toolbox ile Duygu Analizi

    Deneyimi SVM ile Ham&Spam Maillerin Tespit Edilmesi Python ile Makine Öğrenimi Kullanarak Sathe Haber Tahmini
  14. Yazılımcı olarak ML Yol Haritam Reinforcement Learning’in Derinlemesine Analizi: Ödüllerle

    Dolu Öğrenme Macerası Langchain Seyir Defterim Yazılımcılar için Yapay Zeka Yolculuğu
  15. Yazılımcı olarak ML Yol Haritam ML .NET: Makine Öğreniminde Yeni

    Yollar OpenAI .NET API Kullanımı: Yapay Zeka Gücünü .NET Projelerinize Taşıyın Thor ve Loki Gibi:LangChain ve LangGraph’ın Güçlü İş Birliği