Skip to content

Commit 880c7c4

Browse files
eyurtsevolgamurraft
authored andcommitted
fireworks: Add APIReference for the FireworksEmbeddings model (langchain-ai#25292)
Add API Reference documentation for the FireworksEmbedding model. Issue: langchain-ai#24856
1 parent e414bbc commit 880c7c4

File tree

1 file changed

+53
-7
lines changed

1 file changed

+53
-7
lines changed

libs/partners/fireworks/langchain_fireworks/embeddings.py

Lines changed: 53 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,62 @@
88

99

1010
class FireworksEmbeddings(BaseModel, Embeddings):
11-
"""FireworksEmbeddings embedding model.
11+
"""Fireworks embedding model integration.
1212
13-
Example:
14-
.. code-block:: python
13+
Setup:
14+
Install ``langchain_fireworks`` and set environment variable
15+
``FIREWORKS_API_KEY``.
1516
16-
from langchain_fireworks import FireworksEmbeddings
17+
.. code-block:: bash
1718
18-
model = FireworksEmbeddings(
19-
model='nomic-ai/nomic-embed-text-v1.5'
20-
)
19+
pip install -U langchain_fireworks
20+
export FIREWORKS_API_KEY="your-api-key"
21+
22+
Key init args — completion params:
23+
model: str
24+
Name of Fireworks model to use.
25+
26+
Key init args — client params:
27+
fireworks_api_key: SecretStr
28+
Fireworks API key.
29+
30+
See full list of supported init args and their descriptions in the params section.
31+
32+
Instantiate:
33+
.. code-block:: python
34+
35+
from __module_name__ import FireworksEmbeddings
36+
37+
model = FireworksEmbeddings(
38+
model='nomic-ai/nomic-embed-text-v1.5'
39+
# Use FIREWORKS_API_KEY env var or pass it in directly
40+
# fireworks_api_key="..."
41+
)
42+
43+
Embed multiple texts:
44+
.. code-block:: python
45+
46+
vectors = embeddings.embed_documents(['hello', 'goodbye'])
47+
# Showing only the first 3 coordinates
48+
print(len(vectors))
49+
print(vectors[0][:3])
50+
51+
.. code-block:: python
52+
53+
2
54+
[-0.024603435769677162, -0.007543657906353474, 0.0039630369283258915]
55+
56+
57+
Embed single text:
58+
.. code-block:: python
59+
60+
input_text = "The meaning of life is 42"
61+
vector = embeddings.embed_query('hello')
62+
print(vector[:3])
63+
64+
.. code-block:: python
65+
66+
[-0.024603435769677162, -0.007543657906353474, 0.0039630369283258915]
2167
"""
2268

2369
_client: OpenAI = Field(default=None)

0 commit comments

Comments
 (0)