Skip to content

Commit 1fe867d

Browse files
CatherineCatherine
authored andcommitted
Updated README.md to clarify Pinecone account requirement, added newlines after command outputs, improved error handling for missing API keys, and updated version to 0.6.0: Co-authored-by: MindFlow <mf@mindflo.ai>
1 parent 400e526 commit 1fe867d

File tree

6 files changed

+16
-7
lines changed

6 files changed

+16
-7
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ The [ChatGPT](https://openai.com/blog/chatgpt)-powered swiss army knife for the
2424

2525
Pre-requisite:
2626
- You'll need to create an [OpenAI](https://openai.com/blog/openai-api) account.
27-
- Also, create a [Pinecone](https://www.pinecone.io/start) account to use their vector database.
27+
- Also, create a [Pinecone](https://www.pinecone.io/start) account to use their vector database if you would like to use the `chat with documents` feature.
2828

2929
1. Run `pip install mindflow`, or you can clone this repo and run `pip install -e path/to/mindflow`.
3030
2. Run `mf login`:

mindflow/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.5.5"
1+
__version__ = "0.6.0"

mindflow/cli/commands/chat.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ async def stream_chat(settings: Settings, prompt: str):
4141
click.echo(char_stream_chunk.value, nl=False)
4242
else:
4343
click.echo(char_stream_chunk.value)
44+
print("\n")
4445

4546
async def stream_query(settings: Settings, file_paths: List[str], prompt: str):
4647
click.echo(colored("\nGPT:", attrs=["bold"]))
@@ -49,6 +50,7 @@ async def stream_query(settings: Settings, file_paths: List[str], prompt: str):
4950
click.echo(char_stream_chunk.value, nl=False)
5051
else:
5152
click.echo(char_stream_chunk.value)
53+
print("\n")
5254

5355
prompt, paths = parse_chat_prompt_and_paths_from_args(prompt_args)
5456
settings = Settings()
@@ -59,7 +61,7 @@ async def stream_query(settings: Settings, file_paths: List[str], prompt: str):
5961
)
6062
else:
6163
click.echo(
62-
colored("Indexing paths... Note: this may take a while, if you want to skip this step, use the `--skip-index` flag. If you do so, you can pre-select specific paths to index with `mf index`.\n", "yellow")
64+
colored("Indexing paths... Note: this may take a while, especially the first time. If it fails, or gets stuck, retry and it will pick up where you left off. If you want to skip this step, use the `--skip-index` flag. If you do so, you can pre-select specific paths to index with `mf index`.\n", "yellow")
6365
)
6466

6567
asyncio.run(run_index(settings, paths))

mindflow/cli/commands/git/diff.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,6 @@ async def stream_diff(settings: Settings, diff_output: str, detailed: bool):
3939
click.echo(char_stream_chunk.value, nl=False)
4040
else:
4141
click.echo(char_stream_chunk.value)
42+
print("\n")
4243

4344
asyncio.run(stream_diff(Settings(), diff_output, detailed=detailed))

mindflow/cli/commands/login.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def login():
1313
ServiceConfigID.PINECONE.value,
1414
]
1515
service_options = [
16-
ServiceConfig.load(service_id, False) for service_id in service_ids
16+
ServiceConfig.load(service_id) if ServiceConfig.load(service_id) is not None else ServiceConfig(service_id) for service_id in service_ids
1717
]
1818
service_descriptions = ["OpenAI", "Pinecone: (Vector DB)"]
1919
service_config: ServiceConfig = select_option(

mindflow/core/types/model.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import json
2+
import sys
23
import time
34
import aiohttp
45
import logging
@@ -189,8 +190,14 @@ def __init__(self, model_id: str):
189190
}
190191
)
191192

192-
if service_config := ServiceConfig.load(f"{self.model.service}_config"):
193-
self.api_key = service_config.api_key
193+
service_config = ServiceConfig.load(f"{self.model.service}_config")
194+
if service_config == None or not hasattr(service_config, "api_key"):
195+
print(
196+
f"No {self.model.service} API key found. Please set {self.model.service} API key with `mf login`."
197+
)
198+
sys.exit(1)
199+
200+
self.api_key = service_config.api_key
194201

195202
self.headers = {
196203
"Authorization": f"Bearer {self.api_key}",
@@ -399,7 +406,6 @@ async def call_api_stream( # type: ignore
399406
await self.status_tracker.increment_requests_count_successful()
400407
await self.status_tracker.decrement_requests_count_in_progress()
401408
if not result["choices"][0]["delta"]:
402-
print("No delta")
403409
continue
404410
yield Ok(
405411
result["choices"][0]["delta"]["content"]

0 commit comments

Comments
 (0)