জেমিনি ন্যানো পরীক্ষামূলক অ্যাক্সেস দিয়ে শুরু করুন

জেমিনি ন্যানো পরীক্ষামূলক অ্যাক্সেস ডেভেলপারদের জন্য ডিজাইন করা হয়েছে যারা অত্যাধুনিক অন-ডিভাইস এআই ক্ষমতা সহ তাদের অ্যাপের উন্নতি পরীক্ষা করতে চায়। আপনার নিজের অ্যাপে Google AI Edge SDK ব্যবহার করে জেমিনি ন্যানো নিয়ে কীভাবে পরীক্ষা করা যায় তার বিশদ বিবরণ এই নির্দেশিকা প্রদান করে।

নমুনা অ্যাপ্লিকেশন পান

আপনি যদি একটি প্রস্তুত ডেমো সহ অনুসরণ করতে চান, GitHub-এ আমাদের নমুনা অ্যাপটি দেখুন।

পূর্বশর্ত

জেমিনি ন্যানো নিয়ে পরীক্ষা করার জন্য, আপনার একটি Pixel 9 সিরিজের ডিভাইস প্রয়োজন। এগিয়ে যাওয়ার আগে নিশ্চিত করুন যে আপনার হাতে একটি আছে এবং আপনি শুধুমাত্র সেই অ্যাকাউন্ট দিয়ে লগ ইন করেছেন যা আপনি পরীক্ষার জন্য ব্যবহার করতে চান৷

  1. আইকোর-পরীক্ষামূলক Google গ্রুপে যোগ দিন
  2. Android AICore টেস্টিং প্রোগ্রামে অপ্ট ইন করুন৷

আপনি এই পদক্ষেপগুলি সম্পূর্ণ করার পরে, প্লে স্টোরে অ্যাপের নাম (অ্যাপস এবং ডিভাইস পরিচালনার অধীনে) "Android AICore" থেকে "Android AICore (Beta)" এ পরিবর্তিত হওয়া উচিত।

APK আপডেট করুন এবং বাইনারি ডাউনলোড করুন

  1. AICore APK আপডেট করুন:
    1. উপরের ডানদিকে, প্রোফাইল আইকনে আলতো চাপুন
    2. অ্যাপস এবং ডিভাইস পরিচালনা করুন > পরিচালনা করুন আলতো চাপুন
    3. Android AICore-এ আলতো চাপুন
    4. একটি আপডেট উপলব্ধ হলে আপডেট আলতো চাপুন
  2. প্রাইভেট কম্পিউট সার্ভিস APK আপডেট করুন:
    1. উপরের ডানদিকে, প্রোফাইল আইকনে আলতো চাপুন
    2. অ্যাপস এবং ডিভাইস পরিচালনা করুন > পরিচালনা করুন আলতো চাপুন
    3. প্রাইভেট কম্পিউট সার্ভিসে ট্যাপ করুন
    4. একটি আপডেট উপলব্ধ হলে আপডেট আলতো চাপুন
    5. এই অ্যাপ সম্পর্কে ট্যাবের অধীনে সংস্করণটি দেখুন এবং নিশ্চিত করুন যে অ্যাপটির সংস্করণটি 1.0.release.658389993 বা উচ্চতর
  3. আপনার ডিভাইস পুনরায় চালু করুন এবং পরীক্ষার তালিকা কার্যকর হওয়ার জন্য কয়েক মিনিট অপেক্ষা করুন
  4. প্লে স্টোরে ("এই অ্যাপ সম্পর্কে" ট্যাবের অধীনে) AICore APK সংস্করণটি 0.thirdpartyeap দিয়ে শুরু হয়েছে তা নিশ্চিত করতে দেখুন

গ্রেডেল কনফিগার করুন

আপনার build.gradle কনফিগারেশনে নির্ভরতা ব্লকে নিম্নলিখিত যোগ করুন:


implementation("com.google.ai.edge.aicore:aicore:0.0.1-exp01")

আপনার build.gradle কনফিগারেশনে, ন্যূনতম SDK টার্গেট 31 এ সেট করুন:

defaultConfig {
    ...
    minSdk = 31
    ...
}

AICore পান এবং অনুমান চালান

একটি GenerationConfig অবজেক্ট তৈরি করুন, যাতে মডেলটি কীভাবে অনুমান চালানো উচিত তার বৈশিষ্ট্যগুলি কাস্টমাইজ করার জন্য প্যারামিটার রয়েছে।

পরামিতি অন্তর্ভুক্ত:

  • তাপমাত্রা : এলোমেলোতা নিয়ন্ত্রণ করে; উচ্চ মান বৈচিত্র্য বাড়ায়
  • শীর্ষ K : সর্বোচ্চ র‌্যাঙ্কিং থেকে কতটি টোকেন বিবেচনা করতে হবে
  • প্রার্থীর সংখ্যা : ফিরতে সর্বোচ্চ প্রতিক্রিয়া
  • সর্বোচ্চ আউটপুট টোকেন : প্রতিক্রিয়ার দৈর্ঘ্য
  • Worker Executor : ExecutorService যার উপর ব্যাকগ্রাউন্ডের কাজগুলি চালানো উচিত
  • কলব্যাক এক্সিকিউটর : যে Executor কলব্যাক করা উচিত

কোটলিন

val generationConfig = generationConfig {
  context = ApplicationProvider.getApplicationContext() // required
  temperature = 0.2f
  topK = 16
  maxOutputTokens = 256
}

জাভা

GenerationConfig.Builder configBuilder = GenerationConfig.Companion.builder();
    configBuilder.setContext(context);
    configBuilder.setTemperature(0.2f);
    configBuilder.setTopK(16);
    configBuilder.setMaxOutputTokens(256);

একটি ঐচ্ছিক downloadCallback তৈরি করুন। এটি একটি কলব্যাক ফাংশন যা মডেল ডাউনলোড করার জন্য ব্যবহৃত হয়। ফিরে আসা বার্তাগুলি ডিবাগ করার উদ্দেশ্যে।

GenerativeModel অবজেক্ট তৈরি করুন জেনারেশন এবং ঐচ্ছিক ডাউনলোড কনফিগ যা আপনি আগে তৈরি করেছেন।

কোটলিন

val downloadConfig = DownloadConfig(downloadCallback)
val model = GenerativeModel(
   generationConfig = generationConfig,
   downloadConfig = downloadConfig // optional
)

জাভা

GenerativeModel model = new GenerativeModel(
   generationConfig,
   downloadConfig = DownloadConfig(downloadCallback) // optional
);

মডেলের সাথে অনুমান চালান এবং আপনার প্রম্পটে পাস করুন। যেহেতু GenerativeModel.generateContent() একটি সাসপেন্ড ফাংশন, তাই আমাদের নিশ্চিত করতে হবে যে এটি লঞ্চ করার জন্য সঠিক কোরোটিন সুযোগে আছে।

কোটলিন

scope.launch {
  // Single string input prompt
  val input = "I want you to act as an English proofreader. I will provide you
    texts, and I would like you to review them for any spelling, grammar, or
    punctuation errors. Once you have finished reviewing the text, provide me
    with any necessary corrections or suggestions for improving the text: These
    arent the droids your looking for."
  val response = generativeModel.generateContent(input)
  print(response.text)

  // Or multiple strings as input
  val response = generativeModel.generateContent(
  content {
    text("I want you to act as an English proofreader. I will provide you texts
      and I would like you to review them for any spelling, grammar, or
      punctuation errors.")
    text("Once you have finished reviewing the text, provide me with any
      necessary corrections or suggestions for improving the text:")
    text("These arent the droids your looking for.")
    }
  )
  print(response.text)
}

জাভা

Futures.addCallback(
    String input = "I want you to act as an English proofreader. I will
    provide you texts, and I would like you to review them for any
    spelling, grammar, or punctuation errors. Once you have finished
    reviewing the text, provide me with any necessary corrections or
    suggestions for improving the text:
    These aren't the droids you're looking for."
    modelFutures.generateContent(input),
    new FutureCallback<GenerateContentResponse>() {
      @Override
      public void onSuccess(GenerateContentResponse result) {
        // generation successful
      }

      @Override
      public void onFailure(Throwable t) {
        // generation failed
      }
    },
    ContextCompat.getMainExecutor(this));

আপনার যদি Google AI Edge SDK সম্পর্কে কোনো প্রতিক্রিয়া বা আমাদের দলের জন্য অন্য কোনো প্রতিক্রিয়া থাকে, তাহলে একটি টিকিট জমা দিন

প্রম্পট টিপস

প্রম্পট ডিজাইন হল প্রম্পট তৈরি করার প্রক্রিয়া যা ভাষার মডেলগুলি থেকে একটি সর্বোত্তম প্রতিক্রিয়া তৈরি করে। একটি ভাষা মডেল থেকে সঠিক, উচ্চ মানের প্রতিক্রিয়া নিশ্চিত করার জন্য ভাল কাঠামোগত প্রম্পট লেখা একটি অপরিহার্য অংশ। জেমিনি ন্যানো-এর সাধারণ ব্যবহারের ক্ষেত্রে আপনাকে শুরু করতে আমরা কিছু উদাহরণ অন্তর্ভুক্ত করেছি। আরও তথ্যের জন্য মিথুন প্রম্পটিং কৌশলগুলি দেখুন।

পুনর্লিখনের জন্য:

I want you to act as an English proofreader. I will provide you texts, and I
would like you to review them for any spelling, grammar, or punctuation errors.
Once you have finished reviewing the text, provide me with any necessary
corrections or suggestions for improving the text: These arent the droids your
looking for

স্মার্ট উত্তর ব্যবহারের ক্ষেত্রে:

Prompt: Predict up to 5 emojis as a response to a text chat message. The output
should only include emojis.

input: The new visual design is blowing my mind 🤯
output: ➕,💘, ❤‍🔥

input: Well that looks great regardless
output: 💗,🪄

input: Unfortunately this won't work
output: 💔,😔

input: sounds good, I'll look into that
output: 🙏,👍

input: 10hr cut of jeff goldblum laughing URL
output: 😂,💀,⚰️

input: Woo! Launch time!
Output:

সারসংক্ষেপের জন্য:

Summarize this text as bullet points of key information.
Text: A quantum computer exploits quantum mechanical phenomena to perform
  calculations exponentially faster than any modern traditional computer. At
  very tiny scales, physical matter acts as both particles and as waves, and
  quantum computing uses specialized hardware to leverage this behavior. The
  operating principles of quantum devices are beyond the scope of classical
  physics. When deployed at scale, quantum computers could be used in a wide
  variety of applications such as: in cybersecurity to break existing encryption
  methods while helping researchers create new ones, in meteorology to develop
  better weather forecasting etc. However, the current state-of-the-art quantum
  computers are still largely experimental and impractical.