Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhanced Docs: LLM Embedding Examples #844

Merged
merged 5 commits into from
Jan 2, 2025

Conversation

igorlima
Copy link
Contributor

This PR enriches the documentation with an array of embedding examples. These examples illustrate how to generate embeddings using the power of renowned LLMs within the txtai library.

This documentation enhancement was sparked by an issue seeking guidance on integrating Gemini with txtai. The idea is to hope these examples make someone else's journey smoother and more enjoyable!

@igorlima
Copy link
Contributor Author

Since it's my first PR for this library, I'm open to suggestions or improvements.

If everything looks good as it is, that's awesome! Feel free to share thoughts on organizing or listing the examples on the Examples page.

@igorlima igorlima marked this pull request as ready for review December 27, 2024 04:01
@davidmezzetti
Copy link
Member

davidmezzetti commented Dec 27, 2024

Hello. Thank you for wanting to improve the documentation here! This is great!

What if this was a notebook instead? Then we could also publish a corresponding blog article like the others, which would give it more visibility. It could be titled something like "Getting started with LLM APIs", with a subtitle of "Generate embeddings and run LLMs with Gemini, VertexAI, Mistral, Cohere and AWS Bedrock".

Would it make sense to add OpenAI and Claude given those are the two most popular?

In a notebook, I believe the common code could also be consolidated into a two functions, one for the LLM and one for the embeddings. Then there could be a section per provide that passes the model path and initializes any keys / other calls.

Additionally, I don't believe any of the method='litellm' calls are required. There is autodetection logic that should know it's a litellm model.

@igorlima
Copy link
Contributor Author

I've moved it already to a Notebook, and you can check it out here:

While I plan to add other models like OpenAI, Claude, and Groq later, here's a sneak peek at the current Table of Contents for the Notebook.

  • ToC

    image

@davidmezzetti
Copy link
Member

Looking great! Did you want to wait to merge until the other models were added?

@davidmezzetti davidmezzetti added this to the v8.2.0 milestone Dec 27, 2024
@davidmezzetti
Copy link
Member

One other thing with Groq, does it have an embeddings API? I see it's using a local embeddings model.

@igorlima
Copy link
Contributor Author

igorlima commented Dec 28, 2024

I've got another version of the Notebook. Feel free to check it out here:

Interestingly, Groq and Claude don't have their embedding models. Instead, they refer to other models:

  • Groq's blog highlights the jinaai/jina-embeddings-v2-base-en, which seems to be a locally hosted model. Read more here: Groq Blog
  • Claude's documentation points to the Voyage AI embedding model. More details are available here: Claude Anthropic Docs

In the config, I've defaulted both options to False. Do you think I should keep them there?

Interestingly, the final outputs show how different text embedding searches can be across models. The notebook provides a handy comparison, helping us understand which text embedding best suits a context.

@davidmezzetti
Copy link
Member

What if for the two that don't have embeddings APIs, you just use Voyage? Or there can be a note saying there is no embeddings API for this provider but they suggest "...".

The other notebooks all install txtai from GitHub vs PyPI. I see the note about using a specific version but the flip side to that is that limiting code to a specific version misses important security updates. I've always taken the approach to always upgrade and fix the problems as they arise (usually it's caught during the GitHub actions build).

Once again this is really cool and I really appreciate it. Once this PR is merged, I'll get a corresponding article up with a note crediting you. Would you prefer me to link to your GitHub profile or LinkedIn profile in those articles?

@igorlima
Copy link
Contributor Author

igorlima commented Dec 28, 2024

Here is the updated version of Notebook:

A couple of notes:

  • I left a note for Groq, Claude, and Voyage mentioning their minor limitations in this specific Notebook context.
  • I've also addressed the txtai installation by pointing directly to the Github page instead of PyPI.
  • If you want to give credit, I'd be thrilled if you could link to my GitHub profile. It's where all my geek stuff and coding come to flourish! Thank you so much for considering this. 😊

@davidmezzetti
Copy link
Member

davidmezzetti commented Dec 30, 2024

All sounds great and thanks again!

I'll merge and create an article crediting you (linking to your GitHub profile). I may make a few minor edits but otherwise everything is looking good.

I'll follow up here once everything is ready. It will take me a few days before I get to this though.

@davidmezzetti davidmezzetti merged commit 991ea6a into neuml:master Jan 2, 2025
3 checks passed
@igorlima igorlima deleted the enhance-doc branch January 2, 2025 17:09
@davidmezzetti
Copy link
Member

@igorlima Thank you for this contribution! This PR has been merged and the following articles published.

https://dev.to/neuml/getting-started-with-llm-apis-2j89
https://neuml.hashnode.dev/getting-started-with-llm-apis

@igorlima
Copy link
Contributor Author

igorlima commented Jan 5, 2025

I saw this post on LinkedIn, too, and I must say that I liked it! Thanks for sharing.

@davidmezzetti
Copy link
Member

Thank you for putting this together. I'm sure it will gain more and more traction as time goes on. It's a solid resource!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants