चैट रोल असाइन करना

Llama 3 के साथ काम करना

Imtihan Ahmed

Machine Learning Engineer

रोल तय करना

  • मॉडल के टोन को सुधारना
  • उदाहरण: कस्टमर सपोर्ट चैटबोट

चैटबोट से बातचीत - 1

Llama 3 के साथ काम करना

रोल तय करना

  • मॉडल के टोन को सुधारना
  • उदाहरण: कस्टमर सपोर्ट चैटबोट

चैटबोट से बातचीत - 2

Llama 3 के साथ काम करना

रोल तय करना

  • मॉडल के टोन को सुधारना
  • उदाहरण: कस्टमर सपोर्ट चैटबोट

चैटबोट से बातचीत - 3

Llama 3 के साथ काम करना

चैट कम्प्लीशन में रोल का उपयोग

  • Llama की प्रतिक्रियाओं को गाइड करने के लिए चैट रोल

Screenshot 2025-02-26 at 15.32.28.png

  • पर्सनैलिटी और स्टाइल सेट करता है

 

Screenshot 2025-02-26 at 15.31.50.png

  • प्रश्न पूछने वाले व्यक्ति को दर्शाता है
Llama 3 के साथ काम करना

चैट कम्प्लीशन में रोल का उपयोग

  • एक structured बातचीत भेजना

  • create_chat_completion() फंक्शन

from llama_cpp import Llama

llm = Llama(model_path="path/to/model.gguf")

message_list = [...] # This list includes roles
response = llm.create_chat_completion(
messages = message_list
)
Llama 3 के साथ काम करना

System रोल

  • System संदेश: मॉडल को कैसे व्यवहार करना चाहिए, इसकी निर्देशिका
system_message = "You are a business consultant who gives data-driven answers."

message_list = [{
"role": "system",
"content": system_message
}]
Llama 3 के साथ काम करना

User रोल

  • User संदेश: मॉडल से पूछा गया prompt
system_message = "You are a business consultant who gives data-driven answers."

user_message = "What are the key factors in a successful marketing strategy?"
message_list = [{"role": "system", "content": system_message},
{ "role": "user", "content": user_message }
]
Llama 3 के साथ काम करना

रेस्पॉन्स जनरेट करना

from llama_cpp import Llama
llm = Llama(model_path="path/to/model.gguf")

system_message = "You are a business consultant who gives data-driven answers."
user_message = "What are the key factors in a successful marketing strategy?"

message_list = [{"role": "system", "content": system_message},
               {"role": "user", "content": user_message}]

response = llm.create_chat_completion(messages = message_list) print(response)
{'id': ..., 'object': ..., 'created': ..., 'model': ..., 'choices': [...], ...}
Llama 3 के साथ काम करना

Assistant रोल

response["choices"][0]

रेस्पॉन्स आउटपुट

Llama 3 के साथ काम करना

Assistant रोल

response["choices"][0]

संदेश हाइलाइट के साथ रेस्पॉन्स आउटपुट

Llama 3 के साथ काम करना

Assistant रोल

response["choices"][0]

रोल हाइलाइट के साथ रेस्पॉन्स आउटपुट

Llama 3 के साथ काम करना

Assistant रोल

response["choices"][0]

कंटेंट हाइलाइट के साथ रेस्पॉन्स आउटपुट

result['choices'][0]['message']['content']
'A successful marketing strategy relies on clear objectives, established 
through specific, measurable goals. Understanding the target audience ...'
Llama 3 के साथ काम करना

अभ्यास करते हैं!

Llama 3 के साथ काम करना

Preparing Video For Download...