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

Update README.rst #8

Merged
merged 2 commits into from
Jul 11, 2024
Merged

Update README.rst #8

merged 2 commits into from
Jul 11, 2024

Conversation

volkfox
Copy link
Contributor

@volkfox volkfox commented Jul 11, 2024

syncing with Notion page

syncing with Notion page
Copy link
Member

@dmpetrov dmpetrov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the change! Please address the comments inline.

@@ -12,257 +12,291 @@
.. |Tests| image:: https://github.com/iterative/dvcx/workflows/Tests/badge.svg
:target: https://github.com/iterative/dvcx/actions?workflow=Tests
:alt: Tests
.. |License| image:: https://img.shields.io/pypi/l/datachain
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

|License| need to be removed from the top as well

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@volkfox It looks like it didn't get removed from the top, which is causing build failures

from datachain.lib.feature import Feature
from mistralai.client import MistralClient
from mistralai.models.chat_completion import ChatMessage
from datachain.lib.dc import Column, DataChain
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not ordered and not separated in a usual way. Please run it through a linter.

from datachain.lib.dc import Column, DataChain

source = "gs://datachain-demo/chatbot-KiT/"
PROMPT = "Was this bot dialog successful? Describe the 'result' as 'Yes' or 'No' in a short JSON"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use only capital laters or only lowercase in the variables. not the mix.

api_key = os.environ["MISTRAL_API_KEY"]

chain = (
DataChain.from_storage(source)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please put the link here, not variable. It would be more visual for users.

.map(
mistral_response=lambda file: MistralClient(api_key=api_key)
.chat(
model=model,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same - get rid of the variable. it would be more visual for users


.. code:: py

ds = dc.DataChain("mydataset", version = 1)
failed_dialogs = chain.filter(Column("mistral_response") == '{"result": "No"}')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way to get rid of JSON-as-text comparison?


In the example above, the chain resolves to a saved dataset “mydataset”. DataChain datasets are immutable and versioned. A saved dataset version can be used as a data source:
->
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to get rid of this -> notation. Please investigate the ways other project show the ouput in the code.

class CompletionResponseChoice(Feature):
message: MyChatMessage = MyChatMessage()

class MistralModel(Feature):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use pydantic_to_feature() - this should work after #5 is merged


## Populate model instances ###
chain = (
DataChain.from_storage(source)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need in source variable - text instead (see above)

->
<class '__main__.MistralModel'>
<class '__main__.MistralModel'>
<class '__main__.MistralModel'>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does not look good. How about:

assert isinstance(object, MistralModel)
print(object.dict())

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, object is not the best name. obj is ok.

@volkfox volkfox closed this Jul 11, 2024
@volkfox volkfox reopened this Jul 11, 2024
@volkfox volkfox merged commit f500052 into main Jul 11, 2024
4 of 20 checks passed
@volkfox volkfox deleted the volkfox-patch-1 branch July 11, 2024 16:34
dc.DataChain("mydataset").export("./", "claude.response") # export summaries
# pip install mistralai
# this example requires a free Mistral API key, get yours at https://console.mistral.ai
# add the key to your shell environment: $ export MISTRAL_API_KEY= your key
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dmpetrov @volkfox (probably you discussed this already, just to double check). It feels a bit heavy handed tbh - code-wise (needs some brain power to understand what is going on), also (a bigger concern) - it requires an API key to run (people won't be trying this most likely and in a lot of envs it will be blocked).


Tutorials
------------------

* `Computer Vision <examples/computer_vision/fashion_product_images/1-quick-start.ipynb>`_ (try in `Colab <https://colab.research.google.com/github/iterative/dvcx/blob/main/examples/computer_vision/fashion_product_images/1-quick-start.ipynb>`__)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason this was dropped?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. We definitely need these.

@shcheklein
Copy link
Member

@volkfox it seems it broke CI. Can you please take a look and fix this?

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.

4 participants