-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests fixed, added instructions in the readme
- Loading branch information
1 parent
8f083b4
commit 3fd5d18
Showing
5 changed files
with
63 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,18 @@ | ||
This Native App examplifies how to implement the Cortex Complete and to make it interact with user data. | ||
|
||
For this usecase, the dataset used is rather small, with only 10 entries, this is because the language model used in the Cortex function restricts the bytes of input data size and costs. YOu can change the language model used to a bigger or different style according to your necessities. | ||
For more information about it please visit **[this page](https://docs.snowflake.com/en/user-guide/snowflake-cortex/llm-functions#cost-considerations)**. | ||
|
||
To run this example first execute this command: | ||
```bash | ||
```sh | ||
snow sql -f 'prepare/prepare_data.sql' | ||
``` | ||
|
||
Then run `snow app run` on your terminal. | ||
|
||
Currently it has a very short dataset due to llm model bytes limit. | ||
To delete the database and the app run | ||
|
||
```sh | ||
snow sql -q 'DROP DATABASE SPOTIFY_CORTEX_DB;' | ||
snow app teardown | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import unittest | ||
from unittest.mock import patch, MagicMock | ||
import pandas as pd | ||
import pytest as pytest | ||
from snowflake import cortex | ||
from snowflake.cortex import Complete | ||
|
||
class TestDataExporter(unittest.TestCase): | ||
|
||
def test_cortex_response(self): | ||
from cortexCaller import CortexCaller | ||
|
||
mock_df = pd.DataFrame([{"TestColumn": "TestValue"}]) | ||
mock_input = 'Test input from user' | ||
cortexCaller = CortexCaller() | ||
cortexCaller.call_complete = MagicMock(name='call_complete') | ||
cortexCaller.call_complete.return_value = 'test answer from cortex' | ||
response = cortexCaller.call_cortex(mock_df, mock_input) | ||
cortexCaller.call_complete.assert_called_once() | ||
assert response == cortexCaller.call_complete.return_value |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters