自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

如何使用Java設計一套多智能體系統(tǒng)

譯文 精選
人工智能 后端
我們將構建一款響應式應用(對來自用戶的輸入做出響應),幫助人們規(guī)劃自己的完美假期。此智能體將根據(jù)用戶指定的餐食、海濱和活動需求,在指定的國家/地區(qū)內推薦最佳城市。

譯者 | 核子可樂

審校 | 重樓

2025年將成為AI智能體之年。在本文的場景中,AI智能體是一套能夠利用AI通過一系列步驟實現(xiàn)目標的系統(tǒng),且具備就結果進行推理及更正的能力。在實踐中,智能體遵循的步驟可總結成圖表形式。

我們將構建一款響應式應用(對來自用戶的輸入做出響應),幫助人們規(guī)劃自己的完美假期。此智能體將根據(jù)用戶指定的餐食、海濱和活動需求,在指定的國家/地區(qū)內推薦最佳城市。

智能體基本架構如下:

在第一階段,智能體將并行收集信息,根據(jù)單一特征對各城市進行排名。最后一步代表根據(jù)信息選出的最佳城市。

本用例僅使用ChatGPT執(zhí)行所有步驟,大家也可根據(jù)需求配合搜索引擎。這里使用Fibry中手動添加的Actor系統(tǒng)以顯示圖形并細化控制并行性。

Fibry是一款輕量化Actor系統(tǒng),允許參與者輕松簡化多線程代碼,且不涉及任何依賴項。Fibry還提供有限狀態(tài)機,這里我們將對其擴展以實現(xiàn)Java編程。

這里建議大家使用Fibry 3.0.2,如:

Plain Text
1
compile group: 'eu.lucaventuri', name: 'fibry', version: '3.0.2'

設定提示詞

第一步是設定大模型所需要的揭示詞:

Java
public static class AiAgentVacations {
  private static final String promptFood = "You are a foodie from {country}. Please tell me the top 10 cities for food in {country}.";
  private static final String promptActivity = "You are from {country}, and know it inside out. Please tell me the top 10 cities in {country} where I can {goal}";
  private static final String promptSea = "You are an expert traveler, and you {country} inside out. Please tell me the top 10 cities for sea vacations in {country}.";
  private static final String promptChoice = """
    You enjoy traveling, eating good food and staying at the sea, but you also want to {activity}. Please analyze the following suggestions from your friends for a vacation in {country} and choose the best city to visit, offering the best mix of food and sea and where you can {activity}.
    Food suggestions: {food}.
    Activity suggestions: {activity}.
    Sea suggestions: {sea}.
    """;

}

設定狀態(tài)

一般我們會在四個步驟中各設定一個狀態(tài)。但由于分支往來比較常見,因此這里專門添加功能來僅使用一個狀態(tài)處理此問題。因此,我們只需要用到兩個狀態(tài):CITIES,即收集信息的城市,以及CHOICE,即我們選定的城市。

Plain Text
1
enum VacationStates { CITIES, CHOICE }

設定上下文

智能體中的各步驟將收集存儲在他處的信息,我們稱之為上下文。理想情況下,每個步驟最好各自獨立,且盡可能少觸及其他步驟。但既要保持實現(xiàn)簡單、使用的代碼量不大,同時保持盡可能多的類型安全性與線程安全,顯然不是件容易的事。

因此這里選擇強制上下文記錄,提供部分功能以更新記錄的值(使用下面列出的反射),同時等待JEP 468(創(chuàng)建派生記錄)的實現(xiàn)。

Java
public record VacationContext(String country, String goal, String food, String activity, String sea, String proposal) {
  public static VacationContext from(String country, String goal) {
    return new VacationContext(country, goal, null, null, null, null);
  }
}

設定節(jié)點

現(xiàn)在我們可以設定智能體的邏輯。本用例允許用戶使用兩種不同的大語言模型,如用于搜索的“普通”模型和用于選擇步驟的“推理”模型。

到這里開始上難度了,因為信息密度很大:

Java
AgentNode<VacationStates, VacationContext> nodeFood = state -> state.setAttribute("food", modelSearch.call("user", replaceField(promptFood, state.data(), "country")));
AgentNode<VacationStates, VacationContext> nodeActivity = state -> state.setAttribute("activity", modelSearch.call("user", replaceField(promptActivity, state.data(), "country")));
AgentNode<VacationStates, VacationContext> nodeSea = state -> state.setAttribute("sea", modelSearch.call("user", replaceField(promptSea, state.data(), "country")));
AgentNode<VacationStates, VacationContext> nodeChoice = state -> {
  var prompt = replaceAllFields(promptChoice, state.data());
  System.out.println("***** CHOICE PROMPT: " + prompt);
  return state.setAttribute("proposal", modelThink.call("user", prompt));
};

大家肯定已經(jīng)猜到,modelSearch代表用于搜索的模型(如ChatGPT 40),

modelThink代表“推理模型”(如ChatGPT o1)。Fibry提供一個簡單的大模型接口和一個簡單的ChatGPT實現(xiàn),并通過ChatGpt類進行公開。

請注意,調用ChatGPT API需要相應的API密鑰,你需要使用“-DOPENAI_API_KEY=xxxx” JVM參數(shù)來定義此密鑰。

還有一個跟Fibry理念相關的小問題,因為其不涉及任何依賴項,所以這在JSON中會比較麻煩。這里Fibry可以通過兩種方式運行:

  • 若檢測到Jackson,F(xiàn)ibry將使用它進行反射以解析JSON。
  • 若未檢測到Jackson,則使用簡單的自定義解析器(似乎可與ChatGPT輸出搭配使用)。但這種方法僅適用于快速測試,不推薦在生產(chǎn)環(huán)境下使用。
  • 或者,你也可以提供自己的JSON處理器實現(xiàn)并調用JsonUtils.setProcessor(),也可查看JacksonProcessor以獲取靈感。
  • replaceField() 和 replaceAllFields()方法由RecordUtils 定義,且只是替換提示詞中文本內容的便捷方法,以便我們將數(shù)據(jù)提供給大模型。 setAttribute()函數(shù)用于設置狀態(tài)中屬性的值,而無需手動重新創(chuàng)建記錄或定義“withers”方法。大家也可以使用其他方法,例如 mergeAttribute(), addToList(), addToSet()和 addToMap()。

構建智能體

邏輯已經(jīng)有了,接下來需要描述各狀態(tài)間的依賴關系圖并指定希望實現(xiàn)的并行性。對于生產(chǎn)運行狀態(tài)下的大型多功能體系統(tǒng),最重要的就是既通過并行性實現(xiàn)性能最大化,又不致耗盡資源、達到速率限制或者超過外部系統(tǒng)的承載上限。這就是Fibry的意義所在,它能讓整個設計思路非常明確,而且設置難度也不算高。

首先創(chuàng)建智能體builder:

Plain Text
var builder = AiAgent.<VacationStates, VacationContext>builder(true);

其中參數(shù)autoGuards 用于對狀態(tài)設置自動保護,其以AND邏輯執(zhí)行,且僅在處理完所有傳入狀態(tài)后才會執(zhí)行該狀態(tài)。

若參數(shù)為false,則每個傳入狀態(tài)調用一次該狀態(tài)。

在以上示例中,若目標是執(zhí)行兩次D,分別在A和C之后,則autoGuards應當為false。若希望在A和C之后再執(zhí)行一次D,則autoGuards應為true。

這里繼續(xù)說回咱們的度假智能體。

Plain Text
builder.addState(VacationStates.CHOICE, null, 1, nodeChoice, null);

讓我們從addState()方法開始。它用于指定某個狀態(tài)應跟蹤另一狀態(tài)并執(zhí)行某個邏輯。此外,大家還可以指定并行性(后文具體介紹)和guards。

在本示例中:

  • 狀態(tài)為CHOICE
  • 無默認的后續(xù)狀態(tài)
  • 并行性為1
  • 無guard

下一狀態(tài)僅為默認狀態(tài),因為節(jié)點可能會覆蓋下一狀態(tài),因此上圖可以在運行時動態(tài)變更,特別是可以執(zhí)行循環(huán)。例如需要重復某些步驟以收集更多或更好的信息這類高級用例。

并行性在這里沒有涵蓋,因為智能體的單次運行不太涉及這個問題,但在大規(guī)模生產(chǎn)中卻非常重要。

在Fibry中,每個節(jié)點都由一個actor支持——所謂actor,其實就是一個包含待處理消息列表的線程。每條消息都代表一個執(zhí)行步驟。因此,并行度指可以一次執(zhí)行的消息數(shù)。具體來講:

  • parallelism == 1 代表只有一個線程管理該步驟,因此每次只能執(zhí)行一條。
  • parallelism > 1 代表有一個線程池支持該actor,線程數(shù)由用戶指定。默認情況下使用虛擬線程。
  • parallelism == 0 代表每條消息都會創(chuàng)建一個由虛擬線程支持的新actor,因此并行度可根據(jù)需求盡量調高。

每個步驟均可獨立配置,因此大家可以靈活配置性能和資源使用情況。請注意,如果parallelism != 1則可能存在多線程,因為與actor相關的線程限制經(jīng)常會丟失。

狀態(tài)壓縮

如前所述,多個狀態(tài)彼此關聯(lián)也是常見情況,比如需要并行執(zhí)行和加入,而后才能轉向公共狀態(tài)。這時候我們不需要設定多個狀態(tài),而只使用其一:

Plain Text
builder.addStateParallel(VacationStates.CITIES, VacationStates.CHOICE, 1, List.of(nodeFood, nodeActivity, nodeSea), null);

在這種情況下,我們看到CITIES 狀態(tài)由三個節(jié)點定義,其中addStateParallel()負責并行執(zhí)行各節(jié)點并等待所有節(jié)點執(zhí)行完成。這時候應該在每個節(jié)點上應用并行性,借此獲取三個單線程actor。

請注意,如果不使用autoGuards,則可將OR 與 AND邏輯混合起來。

如果希望合并一些處于相同狀態(tài)的節(jié)點,但要求其按順序執(zhí)行(例如需要使用前一個節(jié)點生成的信息),則可使用 addStateSerial()方法。

AI智能體的創(chuàng)建很簡單,但需要指定相關參數(shù):

  • 初始狀態(tài)
  • 最終狀態(tài)(可以為null)
  • 盡量并行執(zhí)行的狀態(tài)標記
Plain Text
var vacationAgent = builder.build(VacationStates.CITIES, null, true);

現(xiàn)在我們已經(jīng)有了智能體,調用進程即可使用:

Plain Text
vacationsAgent.process(AiAgentVacations.VacationContext.from("Italy", "Dance Salsa and Bachata"), (state, info) -> System.out.println(state + ": " + info));

此版本的 process() 需要兩個參數(shù):

  • 初始狀態(tài),其中包含智能體執(zhí)行操作所需要的信息
  • 可選監(jiān)聽器,支持如打印各步驟輸出等需求

若需要啟動操作并檢查其后續(xù)返回值,可以使用 processAsync()。

如果大家關注并行選項的更多信息,建議各位查看單元測試 TestAIAgent。它會模擬節(jié)點休眠一段時間后的智能體,借此查看各選項的實際影響:

擴展至多智能體

我們剛剛創(chuàng)建的是一個actor智能體,它會在自己的線程上(加上各節(jié)點使用的所有線程)運行,并實現(xiàn)了Function接口以備不時之需。

多智能體其實沒什么特別,基本邏輯就是一個智能體的一個或多個節(jié)點要求另一智能體執(zhí)行操作。我們可以構建一套智能體庫以將它們良好組合起來,從而簡化整個系統(tǒng)。

接下來,我們要利用之前的智能體輸出計算度假費用,以便用戶判斷是否符合需求。到這里,是不是就跟真正的旅行社很像了?

下圖為構建流程:

首先用提示詞來提取目的地并計算成本。

Java
private static final String promptDestination = "Read the following text describing a destination for a vacation and extract the destination as a simple city and country, no preamble. Just the city and the country. {proposal}";
private static final String promptCost = "You are an expert travel agent. A customer asked you to estimate the cost of travelling from {startCity}, {startCountry} to {destination}, for {adults} adults and {kids} kids}";

這里只需兩個狀態(tài),一個用于研究城市(由上一智能體完成),另一個用于計算費用。

Plain Text
enum TravelStates { SEARCH, CALCULATE }

我們還需要上下文,此上下文負責保存上一智能體的提議。

Plain Text
public record TravelContext(String startCity, String startCountry, int adults, int kids, String destination, String cost, String proposal) { }

之后可以定義智能體邏輯,該邏輯需要另一智能體作為參數(shù)。首節(jié)點調用上一智能體以獲取提議。

Java
var builder = AiAgent.<TravelStates, TravelContext>builder(false);
AgentNode<TravelStates, TravelContext> nodeSearch = state -> {
  var vacationProposal = vacationsAgent.process(AiAgentVacations.VacationContext.from(country, goal), 1, TimeUnit.MINUTES, (st, info) -> System.out.print(debugSubAgentStates ? st + ": " + info : ""));
  return state.setAttribute("proposal", vacationProposal.proposal())
  .setAttribute("destination", model.call(promptDestination.replaceAll("\\{proposal\\}", vacationProposal.proposal())));
};

第二節(jié)點負責計算成本:

Plain Text
AgentNode<TravelStates, TravelContext> nodeCalculateCost = state -> state.setAttribute("cost", model.call(replaceAllFields(promptCost, state.data())));

之后是定義圖表并構建智能體:

Java
builder.addState(TravelStates.SEARCH, TravelStates.CALCULATE, 1, nodeSearch, null);
builder.addState(TravelStates.CALCULATE, null, 1, nodeCalculateCost, null);

var agent = builder.build(TravelStates.SEARCH, null, false);
Now we can instantiate the two agents (I chose to use ChatGPT 4o and ChatGPT 01-mini) and use them:
Java
try (var vacationsAgent = AiAgentVacations.buildAgent(ChatGPT.GPT_MODEL_4O, ChatGPT.GPT_MODEL_O1_MINI)) {
  try (var travelAgent = AiAgentTravelAgency.buildAgent(ChatGPT.GPT_MODEL_4O, vacationsAgent, "Italy", "Dance Salsa and Bachata", true)) {
    var result = travelAgent.process(new AiAgentTravelAgency.TravelContext("Oslo", "Norway", 2, 2, null, null, null), (state, info) -> System.out.println(state + ": " + info));

    System.out.println("*** Proposal: " + result.proposal());
    System.out.println("\n\n\n*** Destination: " + result.destination());
    System.out.println("\n\n\n*** Cost: " + result.cost());
  }
}

最終輸出

假設我們說自己想跳薩爾薩舞和巴恰塔舞,得到的長輸出如下:

目的地

Plain Text
Naples, Italy

提議

Plain Text
Based on the comprehensive analysis of your friends' suggestions, **Naples** emerges as the ideal city for your vacation in Italy. Here's why Naples stands out as the best choice, offering an exceptional mix of excellent food, beautiful seaside experiences, and a vibrant salsa and bachata dance scene:

### **1. Vibrant Dance Scene**
- **Dance Venues:** Naples boasts numerous venues and events dedicated to salsa and bachata, ensuring that you can immerse yourself in lively dance nights regularly.
- **Passionate Culture:** The city's passionate and energetic atmosphere enhances the overall dance experience, making it a hotspot for Latin dance enthusiasts.

### **2. Culinary Excellence**
- **Authentic Neapolitan Pizza:** As the birthplace of pizza, Naples offers some of the best and most authentic pizzerias in the world.
- **Fresh Seafood:** Being a coastal city, Naples provides access to a wide variety of fresh seafood dishes, enhancing your culinary adventures.
- **Delicious Pastries:** Don't miss out on local specialties like **sfogliatella**, a renowned Neapolitan pastry that is a must-try for any foodie.

### **3. Stunning Seaside Location**
- **Bay of Naples:** Enjoy breathtaking views and activities along the Bay of Naples, including boat tours and picturesque sunsets.
- **Proximity to Amalfi Coast:** Naples serves as a gateway to the famous Amalfi Coast, allowing you to explore stunning coastal towns like Amalfi, Positano, and Sorrento with ease.
- **Beautiful Beaches:** Relax on the city's beautiful beaches or take short trips to nearby seaside destinations for a perfect blend of relaxation and exploration.

### **4. Cultural Richness**
- **Historical Sites:** Explore Naples' rich history through its numerous museums, historic sites, and UNESCO World Heritage landmarks such as the Historic Centre of Naples.
- **Vibrant Nightlife:** Beyond dancing, Naples offers a lively nightlife scene with a variety of bars, clubs, and entertainment options to suit all tastes.

### **5. Accessibility and Convenience**
- **Transportation Hub:** Naples is well-connected by air, rail, and road, making it easy to travel to other parts of Italy and beyond.
- **Accommodation Options:** From luxury hotels to charming boutique accommodations, Naples offers a wide range of lodging options to fit your preferences and budget.

### **Conclusion**
Naples perfectly balances a thriving dance scene, exceptional culinary offerings, and beautiful seaside attractions. Its unique blend of culture, history, and vibrant nightlife makes it the best city in Italy to fulfill your desires for travel, good food, and lively dance experiences. Whether you're dancing the night away, savoring authentic pizza by the sea, or exploring nearby coastal gems, Naples promises an unforgettable vacation.

### **Additional Recommendations**
- **Day Trips:** Consider visiting nearby attractions such as Pompeii, the Isle of Capri, and the stunning Amalfi Coast to enrich your travel experience.
- **Local Experiences:** Engage with locals in dance classes or attend festivals to dive deeper into Naples' vibrant cultural scene.

Enjoy your trip to Italy, and may Naples provide you with the perfect blend of everything you're looking for!

費用

Plain Text
To estimate the cost of traveling from Oslo, Norway, to Naples, Italy, for two adults and two kids, we need to consider several key components of the trip: flights, accommodations, local transportation, food, and activities. Here's a breakdown of potential costs:

1. **Flights**:
   - Round-trip flights from Oslo to Naples typically range from $100 to $300 per person, depending on the time of booking, the season, and the airline. Budget airlines might offer lower prices, while full-service carriers could be on the higher end.
   - For a family of four, the cost could range from $400 to $1,200.

2. **Accommodations**:
   - Hotels in Naples can vary significantly. Expect to pay approximately $70 to $150 per night for a mid-range hotel room that accommodates a family. Vacation rentals might offer more flexibility and potentially lower costs.
   - For a typical 5-night stay, this would range from $350 to $750.

3. **Local Transportation**:
   - Public transportation in Naples (buses, metro, trams) is affordable, and daily tickets cost around $4 per person.
   - Assume about $50 to $100 for the family's local transport for the entire trip, depending on usage.

4. **Food**:
   - Dining costs are highly variable. A budget for meals might be around $10-$20 per person per meal at casual restaurants, while dining at mid-range restaurants could cost $20-$40 per person.
   - A family of four could expect to spend around $50 to $100 per day, reaching a total of $250 to $500 for five days.

5. **Activities**:
   - Entry fees for attractions can vary. Some museums and archaeological sites charge around $10 to $20 per adult, with discounts for children.
   - Budget around $100 to $200 for family activities and entrance fees.

6. **Miscellaneous**:
   - Always allow a little extra for souvenirs, snacks, and unexpected expenses. A typical buffer might be $100 to $200.

**Estimated Total Cost**:
- **Low-end estimate**: $1,250
- **High-end estimate**: $2,950

These are general estimates and actual costs can vary based on when you travel, how far in advance you book, and your personal preferences for accommodation and activities. For the most accurate assessment, consider reaching out to airlines for current flight prices, hotels for room rates, and looking into specific attractions you wish to visit.

內容著實不少,而且這還只是兩個“推理”模型的輸出!

但結果非常有趣,那不勒斯也確實是個不錯的選項。接下來我們檢查一下中間結果,發(fā)現(xiàn)得出結論的過程相當合理。

中間輸出

如果感興趣,大家還可以查看中間結果。

餐食

Plain Text
As a foodie exploring Italy, you're in for a treat, as the country boasts a rich culinary heritage with regional specialties. Here's a list of the top 10 cities in Italy renowned for their food:
1. **Bologna** - Often referred to as the gastronomic heart of Italy, Bologna is famous for its rich Bolognese sauce, tasty mortadella, and fresh tagliatelle.
2. **Naples** - The birthplace of pizza, Naples offers authentic Neapolitan pizza, as well as delicious seafood and pastries like sfogliatella.
3. **Florence** - Known for its Florentine steak, ribollita (a hearty bread and vegetable soup), and delicious wines from the surrounding Tuscany region.
4. **Rome** - Enjoy classic Roman dishes such as carbonara, cacio e pepe, and Roman-style artichokes in the bustling capital city.
5. **Milan** - A city that blends tradition and innovation, Milan offers risotto alla milanese, ossobuco, and an array of high-end dining experiences.
6. **Turin** - Known for its chocolate and coffee culture, as well as traditional dishes like bagna cauda and agnolotti.
7. **Palermo** - Sample the vibrant street food scene with arancini, panelle, and sfincione, as well as fresh local seafood in this Sicilian capital.
8. **Venice** - Famous for its seafood risotto, sarde in saor (sweet and sour sardines), and cicchetti (Venetian tapas) to enjoy with a glass of prosecco.
9. **Parma** - Home to the famous Parmigiano-Reggiano cheese and prosciutto di Parma, it’s a haven for lovers of cured meats and cheeses.
10. **Genoa** - Known for its pesto Genovese, focaccia, and variety of fresh seafood dishes, Genoa offers a unique taste of Ligurian cuisine.

Each of these cities offers a distinct culinary experience influenced by local traditions and ingredients, making them must-visit destinations for any food enthusiast exploring Italy.

海濱

Plain Text
Italy is renowned for its stunning coastline and beautiful seaside cities. Here are ten top cities and regions perfect for a sea vacation:

1. **Amalfi** - Nestled in the famous Amalfi Coast, this city is known for its dramatic cliffs, azure waters, and charming coastal villages.
2. **Positano** - Also on the Amalfi Coast, Positano is famous for its colorful buildings, steep streets, and picturesque pebble beachfronts.
3. **Sorrento** - Offering incredible views of the Bay of Naples, Sorrento serves as a gateway to the Amalfi Coast and provides a relaxing seaside atmosphere.
4. **Capri** - The island of Capri is known for its rugged landscape, upscale hotels, and the famous Blue Grotto, a spectacular sea cave.
5. **Portofino** - This quaint fishing village on the Italian Riviera is known for its picturesque harbor, pastel-colored houses, and luxurious coastal surroundings.
6. **Cinque Terre** - Comprising five stunning villages along the Ligurian coast, Cinque Terre is a UNESCO World Heritage site known for its dramatic seaside and hiking trails.
7. **Taormina** - Situated on a hill on the east coast of Sicily, Taormina offers sweeping views of the Ionian Sea and beautiful beaches like Isola Bella.
8. **Rimini** - Located on the Adriatic coast, Rimini is known for its long sandy beaches and vibrant nightlife, making it a favorite for beach-goers and party enthusiasts.
9. **Alghero** - A city on the northwest coast of Sardinia, Alghero is famous for its medieval architecture, stunning beaches, and Catalan culture.
10. **Lerici** - Near the Ligurian Sea, Lerici is part of the stunning Gulf of Poets and is known for its beautiful bay, historic castle, and crystal-clear waters.

Each of these destinations offers a unique blend of beautiful beaches, cultural sites, and local cuisine, making Italy a fantastic choice for a sea vacation.

活動

Plain Text
Italy has a vibrant dance scene with many cities offering great opportunities to enjoy salsa and bachata. Here are ten cities where you can indulge in these lively dance styles:

1. **Rome** - The capital city has a bustling dance scene with numerous salsa clubs and events happening regularly.
2. **Milan** - Known for its nightlife, Milan offers various dance clubs and events catering to salsa and bachata enthusiasts.
3. **Florence** - A cultural hub, Florence has several dance studios and clubs where you can enjoy Latin dances.
4. **Naples** - Known for its passionate culture, Naples offers several venues and events for salsa and bachata lovers.
5. **Turin** - This northern city has a growing salsa community with events and social dances.
6. **Bologna** - Known for its lively student population, Bologna has a number of dance clubs and events for salsa and bachata.
7. **Venice** - While famous for its romantic canals, Venice also hosts various dance events throughout the year.
8. **Palermo** - In Sicily, Palermo has a vibrant Latin dance scene reflecting the island's festive culture.
9. **Verona** - Known for its romantic setting, Verona has several dance studios and clubs for salsa and bachata.
10. **Bari** - This coastal city in the south offers dance festivals and clubs perfect for salsa and bachata enthusiasts.

These cities offer a mix of cultural experiences and lively dance floors, ensuring you can enjoy salsa and bachata across Italy.

有趣的是,那不勒斯在各個分段排名上都沒登頂,但綜合下來卻是最優(yōu)選項。

許可細節(jié)

這里再聊幾句關于Fibry許可證的情況。FIbry目前已經(jīng)不再以純MIT許可證的形式發(fā)布。最大的變更是,如果大家想要急雨 套系統(tǒng)來為第三方(如軟件工程師智能體)大規(guī)模生成代碼,則需要申請商業(yè)許可證。此外,它還禁止用戶將其作為數(shù)據(jù)集來訓練系統(tǒng)生成代碼(例如ChatGPT不得在Fibry的源代碼上進行訓練)。除此之外,所有用途都不受影響。

總結

希望這篇文章能幫助大家了解如何使用Fibry編寫AI智能體。其實對于分布在多個節(jié)點上的多智能體系統(tǒng),F(xiàn)ibry也不在話下!但受篇幅所限,這里不過多展開。

在Fibry中,通過網(wǎng)絡的消息發(fā)送和接收會被抽象出來,因此無需修改智能體邏輯即可實現(xiàn)分發(fā)。這使得Fibry能夠輕松實現(xiàn)跨節(jié)點擴展,核心邏輯完全不受影響。

祝大家編碼愉快!

原文標題:Designing AI Multi-Agent Systems in Java,作者:Luca Venturi

責任編輯:姜華 來源: 51CTO內容精選
相關推薦

2021-05-27 07:12:19

單點登錄系統(tǒng)

2022-05-17 07:35:13

安全Session

2024-11-19 16:31:23

2024-09-23 04:00:00

java架構分布式系統(tǒng)

2024-11-12 08:13:09

2021-05-06 11:06:52

人工智能語音識別聲聞檢索

2022-11-12 17:50:02

Web服務器微服務

2016-11-28 10:22:52

物聯(lián)網(wǎng)設備系統(tǒng)

2022-08-04 00:05:11

系統(tǒng)分布式流量

2022-02-25 09:00:00

數(shù)據(jù)科學工具架構

2020-10-19 10:35:43

iOS設備尺寸

2019-10-11 15:58:25

戴爾

2020-05-12 14:20:47

GitHub 系統(tǒng)微軟

2009-03-03 13:00:00

虛擬化技術vmwarexen

2025-04-07 07:45:00

AI模型神經(jīng)網(wǎng)絡

2016-10-12 17:42:04

云服務云計算云遷移

2009-06-23 18:01:45

Ajax框架源代碼

2018-08-31 08:42:48

LinuxUnix實用程序
點贊
收藏

51CTO技術棧公眾號