Download codette.py from Raiff1982/Codettes: direct link, hf CLI and curl.
- Browser
- Download file 501 Bytes
-
https://huggingface.co/spaces/Raiff1982/Codettes/resolve/main/codette.py
- Command line
-
hf download hf://spaces/Raiff1982/Codettes/codette.py
-
curl -L -o codette.py https://huggingface.co/spaces/Raiff1982/Codettes/resolve/main/codette.py
501 Bytes
| from pinecone import Pinecone | |
| from pinecone_plugins.assistant.models.chat import Message | |
| pc = Pinecone(api_key=pcsk_3MGbHp_26EnMmQQm72aznGSw4vP3WbWLfbeHjeFbNXWWS8pG5kdwSi7aVmGcL3GmH4JokU | |
| ) | |
| assistant = pc.assistant.Assistant(assistant_name="codette") | |
| msg = Message(content="How old is the earth?") | |
| resp = assistant.chat(messages=[msg]) | |
| print(resp["message"]["content"]) | |
| # With streaming | |
| chunks = assistant.chat(messages=[msg], stream=True) | |
| for chunk in chunks: | |
| if chunk: | |
| print(chunk) | |