Skip to content

Commit

Permalink
feat: add example to use llamaindex_embeddings
Browse files Browse the repository at this point in the history
  • Loading branch information
astappiev committed Dec 1, 2024
1 parent d262949 commit 25a703d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
2 changes: 2 additions & 0 deletions interweb-server/src/test/python/env.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ dependencies:
- openai
- litellm
- langchain-openai
- llama-index
- llama-index-embeddings-openai
15 changes: 15 additions & 0 deletions interweb-server/src/test/python/llamaindex_client.test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import os
from llama_index.embeddings.openai import OpenAIEmbedding

os.environ["OPENAI_API_BASE"] = os.getenv("INTERWEB_HOST", "https://interweb.l3s.uni-hannover.de/v1")
os.environ["OPENAI_API_KEY"] = os.getenv("INTERWEB_APIKEY")

embed_model = OpenAIEmbedding(
model_name="bge-m3:567m"
)

embeddings = embed_model.get_text_embedding(
"Open AI new Embeddings models is great. Lol, Ollama is opensource, and free to use."
)

print(embeddings)

0 comments on commit 25a703d

Please sign in to comment.