|
28 | 28 | try: |
29 | 29 | from openai.types.beta.vector_stores import VectorStoreObject |
30 | 30 | except ImportError: |
31 | | - from openai.types.vector_stores import VectorStoreObject |
| 31 | + from openai.types.vector_store import VectorStore as VectorStoreObject |
32 | 32 |
|
33 | 33 | from astra_assistants import OpenAIWithDefaultKey, AsyncOpenAIWithDefaultKey |
34 | 34 |
|
@@ -614,17 +614,21 @@ def get_headers_for_model(model): |
614 | 614 | if provider == "bedrock": |
615 | 615 | if os.getenv("AWS_ACCESS_KEY_ID") is None or os.getenv("AWS_SECRET_ACCESS_KEY") is None or os.getenv("AWS_REGION_NAME") is None: |
616 | 616 | raise Exception("For bedrock models you must set the AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY and AWS_REGION_NAME environment variables") |
617 | | - headers[AWS_ACCESS_KEY_ID] = os.getenv("AWS_ACCESS_KEY_ID") |
618 | | - headers[AWS_SECRET_ACCESS_KEY] = os.getenv("AWS_SECRET_ACCESS_KEY") |
619 | | - headers[AWS_REGION_NAME] = os.getenv("AWS_REGION_NAME") |
| 617 | + headers[AWS_ACCESS_KEY_ID] = os.getenv("AWS_ACCESS_KEY_ID","") |
| 618 | + headers[AWS_SECRET_ACCESS_KEY] = os.getenv("AWS_SECRET_ACCESS_KEY","") |
| 619 | + headers[AWS_REGION_NAME] = os.getenv("AWS_REGION_NAME","") |
620 | 620 | if provider != "openai": |
621 | 621 | key = utils.get_api_key(provider, dynamic_key) |
622 | 622 | if provider == "openrouter": |
623 | | - key = os.getenv("OPENROUTER_API_KEY") |
| 623 | + key = os.getenv("OPENROUTER_API_KEY","") |
624 | 624 | if provider == "gemini": |
625 | | - key = os.getenv("GEMINI_API_KEY") |
| 625 | + key = os.getenv("GEMINI_API_KEY","") |
626 | 626 | if provider == "ollama": |
627 | | - headers["base_url"]= os.getenv("OLLAMA_API_BASE_URL") |
| 627 | + headers["base-url"]= os.getenv("OLLAMA_API_BASE_URL","") |
| 628 | + if provider == "watsonx": |
| 629 | + headers["base-url"]= os.getenv("WATSONX_API_BASE","") |
| 630 | + headers["project-id"]= os.getenv("WATSONX_PROJECT_ID", "") |
| 631 | + key = os.getenv("WATSONX_API_KEY", "") |
628 | 632 | if key is not None: |
629 | 633 | headers["api-key"] = key |
630 | 634 | return headers |
|
0 commit comments