python

[GPT] chain 연결

으누아빠 2024. 3. 27. 01:34
반응형

 

[결과값]

Great choice! Indian cuisine is known for its bold flavors and aromatic spices. Here's a simple recipe for Chicken Tikka Masala, a popular Indian dish that is sure to impress your taste buds. Chicken Tikka Masala Recipe: Ingredients: - 1 lb boneless, skinless chicken breasts, cut into bite-sized pieces - 1 cup plain yogurt - 2 tablespoons lemon juice - 2 teaspoons ground cumin - 2 teaspoons paprika - 1 teaspoon ground turmeric - 1 teaspoon garam masala - 1 teaspoon ground coriander - 1 teaspoon chili powder (adjust to taste) - Salt and pepper to taste - 2 tablespoons vegetable oil - 1 onion, finely chopped - 3 cloves garlic, minced - 1-inch piece of ginger, grated - 1 can (14 oz) crushed tomatoes - 1 cup heavy cream - Fresh cilantro, chopped (for garnish) Instructions: 1. In a bowl, mix together yogurt, lemon juice, cumin, paprika, turmeric, garam masala, coriander, chili powder, salt, and pepper. Add the chicken pieces and coat them well with the marinade. Cover and refrigerate for at least 1 hour, or overnight for best results.

...

- Paneer is a type of Indian cheese that holds its shape well when cooked. You can find it in Indian grocery stores or make it at home by curdling hot milk with lemon juice or vinegar. - Cut the paneer into cubes and marinate it following the same steps as the chicken in the recipe. - Instead of baking, you can pan-fry the marinated paneer until it's lightly browned on all sides. By substituting tofu or paneer for the chicken in this recipe, you can enjoy a flavorful and satisfying vegetarian version of Chicken Tikka Masala.

 

AIMessageChunk(content="For a vegetarian version of Chicken Tikka Masala, you can replace the chicken with a plant-based alternative such as tofu or paneer. Here's how you can prepare these alternatives:\n\n1. **Tofu**: \n - Use extra-firm tofu and press it to remove excess water. Cut the tofu into bite-sized cubes.\n - To marinate the tofu, follow the same steps as marinating the chicken in the recipe. Tofu absorbs flavors well, so marinating it for at least 1 hour will enhance the taste.\n - Instead of baking, you can pan-fry the marinated tofu in a bit of oil until it's golden brown and slightly crispy.\n\n2. **Paneer**:\n - Paneer is a type of Indian cheese that holds its shape well when cooked. You can find it in Indian grocery stores or make it at home by curdling hot milk with lemon juice or vinegar.\n - Cut the paneer into cubes and marinate it following the same steps as the chicken in the recipe.\n - Instead of baking, you can pan-fry the marinated paneer until it's lightly browned on all sides.\n\nBy substituting tofu or paneer for the chicken in this recipe, you can enjoy a flavorful and satisfying vegetarian version of Chicken Tikka Masala.")

 

final_chain = {"recipe":chef_chain} | veg_chain

chef_chain 결과값을 recipe에 전달한다음 veg_chain 으로 전달한다.

결국 

 

StreamingStdOutCallbackHandler 
스트리밍 용 callback 핸들러 스트리밍을 제공하는 LLMS 에서만 작동


스트리밍 옵션은 질의에 대한 답변을 실시간으로 받을 때 유용

streaming=True 로 설정하고 StreamingStdOutCallbackHandler() 을 콜백으로 지정

 

 

 

'python' 카테고리의 다른 글

[GPT] Few-shot examples for chat models  (0) 2024.03.27
[GPT] FewShotPromptTemplate  (0) 2024.03.27
[GPT] OutputParser and LCEL  (0) 2024.03.26
[GPT] Prompt Templates  (0) 2024.03.26
[GPT] predict_message  (0) 2024.03.26