Lädt...

🔧 AI-Powered Automation: Fine-tuning Gemma for Function Calling


Nachrichtenbereich: 🔧 Programmierung
🔗 Quelle: dev.to

Starting a new job always comes with a mix of excitement and challenges. As I joined Accenture as a Data & AI Senior Manager, I experienced firsthand the complexity of onboarding processes—countless forms, account setups, and access provisioning across multiple systems. This got me thinking:

"How can AI-powered automation streamline employee onboarding and make the experience seamless, for both, new hires and HR teams?"

This project explores how fine-tuning Gemma on Vertex AI can enhance its function-calling capabilities, enabling seamless API integration and workflow automation. By leveraging Gemma's ability to interpret function descriptions, we can dynamically trigger external actions such as fetching data, interacting with databases, and automating enterprise tasks.

This project fine-tunes Gemma to enhance its function-calling capabilities, enabling seamless API integration and workflow automation. Using Vertex AI, we optimize Gemma to interpret function descriptions and dynamically trigger external actions such as fetching data, interacting with databases, and automating enterprise tasks.

What is Function Calling?

Function calling allows language models to identify and execute functions based on user inputs. This is useful for automating workflows and integrating AI into real-world applications such as chatbots, virtual assistants, and enterprise process automation.

Automating the Employee Onboarding Process with AI

A practical use case for function calling is automating the onboarding of new employees. With a fine-tuned Gemma model, we can create an automated workflow that performs essential tasks such as:

  1. Registering the new employee in the CRM
  2. Creating accounts and provisioning access
  3. Sending a welcome email
  4. Scheduling initial training sessions

Setting Up the Environment on Vertex AI

Before we start, we need to configure our environment on Vertex AI. Make sure you have the Google Cloud SDK installed and authenticated:

pip install google-cloud-aiplatform

Then, initialize the Vertex AI client:

from google.cloud import aiplatform

aiplatform.init(project="my-project", location="us-central1")

Creating a Dataset for Fine-Tuning

To train the model on executing onboarding functions, we create a JSONL dataset:

{"input": "Register new employee John Doe with email [email protected] and role Software Engineer", "function": "create_employee_record", "arguments": {"name": "John Doe", "email": "[email protected]", "role": "Software Engineer"}}

{"input": "Provision access for Mary Johnson to the ERP system", "function": "provision_access", "arguments": {"employee_name": "Mary Johnson", "system": "ERP"}}

{"input": "Send welcome email to Carla Smith", "function": "send_welcome_email", "arguments": {"recipient": "Carla Smith"}}

{"input": "Schedule security training for Mark Lewis", "function": "schedule_training", "arguments": {"employee": "Mark Lewis", "training": "Security"}}

This dataset is uploaded to Cloud Storage for training:

bucket_name = "my-bucket"
dataset_path = f"gs://{bucket_name}/dataset.jsonl"

# Upload the dataset
aiplatform.gcs_upload_file("dataset.jsonl", dataset_path)

Fine-Tuning Gemma on Vertex AI

Now, we initiate the fine-tuning of the Gemma model using Vertex AI's API:

tuning_job = aiplatform.CustomJob(
    display_name="fine-tuning-gemma",
    script_path="train.py",  # Training script
    container_uri="us-docker.pkg.dev/vertex-ai/training/tf-cpu.2-8:latest",
    args=["--dataset", dataset_path]
)

tuning_job.run()

The train.py script contains the logic for adjusting the model weights, utilizing LoRA (Low-Rank Adaptation) for efficient optimization.

Testing the Fine-Tuned Model

After training, we can deploy the model and test it:

endpoint = aiplatform.Endpoint.create(
    display_name="gemma-function-calling",
    model_name=tuning_job.model_name
)

response = endpoint.predict(instances=[{"input": "Register new employee John Doe with email [email protected] and role Software Engineer"}])
print(response)

The model now automatically returns the correct function to be called with the appropriate arguments.

Conclusion

Fine-tuning Gemma on Vertex AI is an efficient way to enable function calling, allowing intelligent automation of tasks in real applications. In this example, we created an automated workflow for employee onboarding, demonstrating how AI can optimize enterprise processes.

Want to learn more? Drop your questions in the comments.

Let's go! 🚀

...

🎥 Gemma in Minutes: 3 ways to run Gemma’s latest version!


📈 30.27 Punkte
🎥 Videos

🎥 Demo: Gemma Scope: Sparse autoencoders on Gemma 2


📈 30.27 Punkte
🎥 Videos

📰 Google AI Introduces Gemma-APS: A Collection of Gemma Models for Text-to-Propositions Segmentation


📈 30.27 Punkte
🔧 AI Nachrichten

🔧 Gemma explained: What’s new in Gemma 2


📈 30.27 Punkte
🔧 Programmierung

🔧 Gemma explained: An overview of Gemma model family architectures


📈 30.27 Punkte
🔧 Programmierung

🔧 Gemma 2 gets three new products: a 2B parameter version, ShieldGemma, and Gemma Scope


📈 30.27 Punkte
🔧 Programmierung

🔧 Make the OpenAI Function Calling Work Better and Cheaper with a Two-Step Function Call 🚀


📈 29.5 Punkte
🔧 Programmierung

📰 LLMWare Launches SLIMs: Small Specialized Function-Calling Models for Multi-Step Automation


📈 27.7 Punkte
🔧 AI Nachrichten

📰 Google Releases Gemma-2-JPN: A 2B AI Model Fine-Tuned on Japanese Text


📈 24.83 Punkte
🔧 AI Nachrichten

📰 Google Releases Gemma-2-JPN: A 2B AI Model Fine-Tuned on Japanese Text


📈 24.83 Punkte
🔧 AI Nachrichten

🔧 Difference between calling "panic" and calling "os.Exit(1)" in Go (Golang)


📈 24.1 Punkte
🔧 Programmierung

🔧 Top 13 Reasons Why Your Test Automation Fails | Automation Testing Tutorial | Automation Tester


📈 20.79 Punkte
🔧 Programmierung

🔧 Now it's EASY to do function calling with DeepSeek R1


📈 20.77 Punkte
🔧 Programmierung

⚠️ [dos] - Apple Safari - Out-of-Bounds Read when Calling Bound Function


📈 20.77 Punkte
⚠️ PoC

🔧 New Research Shows How AI Programs Can Multi-Task Like Humans Through Improved Function Calling


📈 20.77 Punkte
🔧 Programmierung

🔧 Anthropic Claude Function Calling and Tools Integration


📈 20.77 Punkte
🔧 Programmierung

🔧 Gemini manual function calling


📈 20.77 Punkte
🔧 Programmierung

🔧 IDE Warning When Calling Async Function with No Await


📈 20.77 Punkte
🔧 Programmierung

🔧 Gemini-1.5-pro Function Calling with Java, Spring and HTTP


📈 20.77 Punkte
🔧 Programmierung

🔧 An introduction to function calling and tool use in LLMs


📈 20.77 Punkte
🔧 Programmierung

🪟 GPT-4 with Vision is available, allowing JSON mode and function calling


📈 20.77 Punkte
🪟 Windows Tipps

🔧 Instant Documents Editing using GPT and Function Calling: A Summary


📈 20.77 Punkte
🔧 Programmierung

📰 MeetKai Releases Functionary-V2.4: An Alternative to OpenAI Function Calling Models


📈 20.77 Punkte
🔧 AI Nachrichten

matomo