You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I’m encountering a ValueError: NULL pointer access error when calling create_completion or create_chat_completion in the NexaTextInference interface. This issue started unexpectedly, despite previously working fine. Restarting my computer didn’t resolve the issue.
Code sample:
from threading import Lock
from nexa_sdk import NexaTextInference, CreateChatCompletionResponse, CreateChatCompletionStreamResponse
from typing import Iterator
class NexaaiIntegration:
_instance: NexaaiIntegration | None = None
_lock: Lock = Lock()
inference: NexaTextInference | None = None
def __new__(cls, model_path="llama3-uncensored") -> NexaaiIntegration:
with cls._lock:
if cls._instance is None:
cls._instance = super(NexaaiIntegration, cls).__new__(cls)
cls._instance.inference = NexaTextInference(
model_path=model_path,
local_path=None,
stop_words=[],
temperature=0.5,
max_new_tokens=100,
top_k=20,
top_p=0.9,
profiling=True,
embedding=True
)
cls._instance.inference.create_embedding("You are an AI assistant for a software engineering team.")
return cls._instance
def create_text_completion(
self, message: str
) -> CreateChatCompletionResponse | Iterator[CreateChatCompletionStreamResponse]:
"""Returns a completion for a chat message."""
return self._instance.inference.create_completion(message)
nexa = NexaaiIntegration()
completion = nexa.create_text_completion("Hello, how are you?")
print(completion)
Steps to Reproduce
Run this code sample:
from threading import Lock
from nexa_sdk import NexaTextInference, CreateChatCompletionResponse, CreateChatCompletionStreamResponse
from typing import Iterator
class NexaaiIntegration:
_instance: NexaaiIntegration | None = None
_lock: Lock = Lock()
inference: NexaTextInference | None = None
def __new__(cls, model_path="llama3-uncensored") -> NexaaiIntegration:
with cls._lock:
if cls._instance is None:
cls._instance = super(NexaaiIntegration, cls).__new__(cls)
cls._instance.inference = NexaTextInference(
model_path=model_path,
local_path=None,
stop_words=[],
temperature=0.5,
max_new_tokens=100,
top_k=20,
top_p=0.9,
profiling=True,
embedding=True
)
cls._instance.inference.create_embedding("You are an AI assistant for a software engineering team.")
return cls._instance
def create_text_completion(
self, message: str
) -> CreateChatCompletionResponse | Iterator[CreateChatCompletionStreamResponse]:
"""Returns a completion for a chat message."""
return self._instance.inference.create_completion(message)
nexa = NexaaiIntegration()
completion = nexa.create_text_completion("Hello, how are you?")
print(completion)
OS
macOS
Python Version
3.11.7
Nexa SDK Version
0.0.9.0
GPU (if using one)
Apple M1 Pro
The text was updated successfully, but these errors were encountered:
Issue Description
I’m encountering a ValueError: NULL pointer access error when calling create_completion or create_chat_completion in the NexaTextInference interface. This issue started unexpectedly, despite previously working fine. Restarting my computer didn’t resolve the issue.
Code sample:
Steps to Reproduce
Run this code sample:
OS
macOS
Python Version
3.11.7
Nexa SDK Version
0.0.9.0
GPU (if using one)
Apple M1 Pro
The text was updated successfully, but these errors were encountered: