Эта статья предназначена для демонстрации решения Twilix в параллельном сравнении с LangChain на примере, созданном LangChain.

Ниже приведен пример ответа из примера LangChain Notion QA (https://github.com/hwchase17/notion-qa).

Решение Twilix направлено на обеспечение превосходства несколькими способами с точки зрения эффективности результатов.

Улучшенная генерация

python qa.py "How do you get a raise?"

Это возвращает:

Answer: To get a raise, one can bring up salary at any moment they want 
and good reasons to raise offcycle include drastic change in role and 
responsibilities, very steep learning curve which makes current pay unfair 
for someone's impact and capabilities, new information internally or 
externally, and new information by benchmarking studies or during hiring. 
Not so good reasons to give a raise include a colleague got another offer 
and uses this to get a raise, 'I earn X for this company, that's a lot of 
money, I want a piece of the pie', and colleague just wants an incentive to 
stay. When determining someone's salary in the first place, Blendle weighs 
up several variables including benchmark, classic figures, and scarcity & 
market value. When life happens, one can agree on what is needed for this 
person in this specific situation and when people work hard, they should be 
poked to take time off so they recharge. For longer leaves of absence, HR 
should be consulted. 

Sources: Notion_DB/Blendle's Employee Handbook a834d55573614857a48a9ce9ec4194e3/Salary Review fd385c04dff04c2bb298f7085bf9e78d.md, Notion_DB/Blendle's Employee Handbook a834d55573614857a48a9ce9ec4194e3/Holidays x 5b552479e5ad40b49ce71fa68840ce35.md

Так что же не так с этим ответом?

  • Ответ имеет следующие проблемы:
  • Это на самом деле не имеет смысла для того, кто буквально спрашивает справочник «как кто-то может получить повышение» в Blendle — почему он поднимает вопрос об отпуске?

Я считаю, что на данный момент это представляет собой более широкую проблему с LangChain — сейчас не так много внимания уделяется получению хороших результатов — просто предоставлению высокоуровневых оболочек.

Я хотел протестировать это решение с помощью Twilix из коробки. Я использовал тот же сплиттер и т. д., но полагаюсь на наше внутреннее запатентованное решение. Запуск этого против LangChain дает:

To get a raise at Blendle, there are a few key factors to consider.

First, it's important to have a good reason for requesting a raise. Valid 
reasons include a drastic change in role and responsibilities, a steep 
learning curve that makes your current pay unfair, or new information either 
internally or externally that justifies a salary increase. It's important to 
be able to quantify and provide evidence for these reasons.

However, there are also not-so-good reasons to request a raise, such as a 
colleague getting another offer and using it as leverage, or simply wanting 
a larger piece of the salary pie without any significant changes in role or 
performance. These reasons are generally not considered valid grounds for a 
raise.

In addition to having a valid reason, it's important to consider 
the overall impact on the company. Before deciding on a raise, you should ask 
questions like:

- If we were to hire someone today for your current job, what would we pay 
them?
- What would be the cost to Blendle as a business to find a new person 
to replace you, considering factors like scarcity, time to hire, and the 
impact on day-to-day operations?

These questions help assess the value of the raise in relation to Blendle as 
a whole.

Lastly, it's worth noting that the process of determining salaries at Blendle 
takes into account benchmarking studies and comparisons with internal peers. 
It also considers classic factors like experience, education, specific 
knowledge, and expertise. Additionally, market value and scarcity are taken 
into consideration.

If you're unsure about how to go about getting a raise or have any other 
questions, it's always best to speak with your lead and HR for guidance and 
support.

Сами решения больше соответствуют вопросу и не дают посторонних ответов. Почему это? Решение Twilix направлено на минимизацию уровня шума. Сумасшедшая часть? Он также легко интегрируется с LangChain, поэтому вы можете использовать его загрузчики, получая при этом хорошие решения.

Улучшенный поиск

Давайте рассмотрим другой вопрос — «Есть ли еда в офисе?»

Ответ LangChain:

Yes, there is lunch in the canteen at around 12 o'clock, free of cost. There 
are also snacks and drinks available after All-hands presentations. However, 
it is recommended to bring your own snacks if you are a big snack lover or 
don't want to be left empty-handed.

Ответ Твиликса:

Yes, there is food in the office. Lunch is provided in the canteen around 
12 o'clock, free of cost. The goal is to have enough food for everyone, 
but sometimes they may run out of stock. In addition, luxury products or 
snacks are occasionally ordered to keep things special and within budget. 
If you have any food-related suggestions, you can send them to 
[email protected]. However, they cannot cater to all individual 
needs.

Хотя ответ Twilix более подробный, он также более верен с точки зрения фактов. Однако, поскольку эти два ответа были такими разными, мне пришлось просмотреть исходный справочник:

Ответ Twilix включал этот источник.

~12 o' clock, there is lunch in the canteen, free of cost. 
Joëlle is in charge of lunch — ask her if you need anything (allergies for 
example).

What you can expect from lunch:

- Healthy: We try to offer products that are not bad for you!
- Enough for everyone: The goal is to have enough food for everyone. But 
sometimes we just run out of stock, bad luck... No worries, we will get some 
more next time.
- Variety: Variation is good. But it's also good to keep some things special. 
Like luxury products or snacks, we order these occasionally. This should keep 
it special and within our budget.
- If you have any food related suggestions, be free to send them to 
[email protected]. But remember this, we can not cater to all 
individual needs. But we always take suggestions into consideration.

В то время как решение LangChain включало этот источник.

**Snacks and more**

There will be beer, soda and snacks after All-hands presentations. 

On any other regular day:

- We might have chips etc, but op = op. We order snacks sometimes.
- This also goes for the cookies, fizzy drinks, beer or club mate.
- Fruit is something we want to provide everyday. If you notice we run out 
of fruit too fast and too often, ping our Office Manager so she can fix this.

If you are a big snack lover or don't want to be left empty-handed, consider 
bringing your own snacks.

Так что же пошло не так и в чем разница?

При выполнении этого решения RAG важно фактически включить в свое решение релевантные результаты поиска. Векторный поиск LangChain в этой ситуации захватил результат «закуски», а не более полезный результат «еда», и поэтому он не дал лучшего ответа.

Важно отметить, что для создания решений RAG результаты поиска часто требуют допустимой погрешности, если они являются векторным поиском, и, следовательно, полезно увеличить количество результатов поиска, подаваемых в подсказку. Сосредоточьтесь на получении хороших, релевантных результатов поиска, что важно для разработчиков, которые хотят создавать решения, полезные для бизнеса. Bad RAG означает дезинформацию и неполный контекст.

Сводка

Из коробки RAG от Langchain оставляет желать лучшего. Решение Twilix RAG предоставляет более полные ответы за счет улучшенной генерации и извлечения из коробки — это то, что Twilix создает в центре внимания. Если вы заинтересованы в испытании альтернативы LangChain для расширенного поиска, я рекомендую учебные пособия на docs.twilix.io!