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

Please Support AnthropicVertex #2839

Open
masakiaota opened this issue Nov 1, 2024 · 0 comments
Open

Please Support AnthropicVertex #2839

masakiaota opened this issue Nov 1, 2024 · 0 comments

Comments

@masakiaota
Copy link

masakiaota commented Nov 1, 2024

It seems that Anthropic is supported, but is AnthropicVertex not supported? When I implement it using AnthropicVertex, it results in an error. Please refer to the code below.

# copy from weave document https://weave-docs.wandb.ai/guides/integrations/anthropic#create-a-model-for-easier-experimentation
import weave    
# use the anthropic library as usual
from anthropic import AnthropicVertex
weave.init('your-project-name')

class JokerModel(weave.Model):
  model: str
  temperature: float
  
  @weave.op() #if commented out, the error will be gone
  def predict(self, topic): # Change to `predict`
    client = AnthropicVertex(region="us-central1", project_id="your-project-name")
    message = client.messages.create(
    max_tokens=1024,
    messages=[
        {
            "role": "user",
            "content": f"Tell me a joke about {topic}",
        }
        ],
        model=self.model,
        temperature=self.temperature
    )
    return message.content[0].text


joker = JokerModel(
    model="claude-3-haiku@20240307",
    temperature = 0.1)
result = joker.predict("Chickens and Robots")
print(result)
TypeError: cannot pickle '_thread.RLock' object

I think this behavior is related to the following issue: #2830

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

No branches or pull requests

1 participant