Skip to content

Commit 8775674

Browse files
fix(dspy): adding language for recently released snowflake retriever model and updating snowflake session init to also include session log
1 parent 441fd43 commit 8775674

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

docs/api/retrieval_model_clients/SnowflakeRM.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ sidebar_position:
66

77
### Constructor
88

9-
Initialize an instance of the `SnowflakeRM` class, with the option to use `e5-base-v2` embeddings or any Snowflake Cortex supported embeddings model.
9+
Initialize an instance of the `SnowflakeRM` class, with the option to use `e5-base-v2` or `snowflake-arctic-embed-m` embeddings or any other Snowflake Cortex supported embeddings model.
1010

1111
```python
1212
SnowflakeRM(

dspy/retrieve/snowflake_rm.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def __init__(
4242
self.embeddings_field = embeddings_field
4343
self.embeddings_text_field = embeddings_text_field
4444
self.embeddings_model = embeddings_model
45-
self.client = Session.builder.configs(snowflake_credentials).create()
45+
self.client = self._init_cortex(credentials=snowflake_credentials)
4646

4747
super().__init__(k=k)
4848

@@ -99,6 +99,14 @@ def _top_k_similar_chunks(self, query_embeddings, k):
9999

100100
return top_k.select(doc_table_key).to_pandas().values
101101

102+
@classmethod
103+
def _init_cortex(cls, credentials: dict) -> None:
104+
105+
session = Session.builder.configs(credentials).create()
106+
session.query_tag = {"origin":"sf_sit", "name":"dspy", "version":{"major":1, "minor":0}}
107+
108+
return session
109+
102110
def _get_embeddings(self, query: str) -> list[float]:
103111
# create embeddings for the query
104112
embed = snow_fn.builtin("snowflake.cortex.embed_text")

0 commit comments

Comments
 (0)